Skip to content

Conversation

@AngersZhuuuu
Copy link
Contributor

@AngersZhuuuu AngersZhuuuu commented Sep 2, 2019

What changes were proposed in this pull request?

28954

For extra jar passed through hive conf HiveConf.ConfVars.HIVEAUXJARS, we don't need to use complex APIs to fix different hive version problem, we just can handle it through spark's SessionResourceLoader's API. add jar to Spark and SparkSession's running env.

For problem mentioned in #25542 , the root cause is :
In SparkSQLCliDriver, we will create a CliSessionState, then we will call
SessionState.start(sessionState), this method will do like blow in SessionState.
image

Then currentThread's ClassLoader will be replaced by hiveConf's ClassLoader, then cause problem mentioned in #25542 .

Fix it by add origin thread's ClassLoader to CliSessionState's conf's ClassLoader before we call
SessionState.start(sessionState)

Why are the changes needed?

Reduce complex code to fit each version of hive.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existed UT is enough

@AngersZhuuuu AngersZhuuuu changed the title [SPARK-28723][FLOW-UP][SQL] In SparkSQL CLI, pass extra jar through hive hive conf HIVEAUXJARS, we just use SessionResourceLoader API to cover multi-version problem [SPARK-28954][SQL] In SparkSQL CLI, pass extra jar through hive hive conf HIVEAUXJARS, we just use SessionResourceLoader API to cover multi-version problem Sep 3, 2019
@wangyum
Copy link
Member

wangyum commented Sep 3, 2019

ok to test

@gatorsmile
Copy link
Member

ok to test

1 similar comment
@HyukjinKwon
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Sep 4, 2019

Test build #110091 has finished for PR 25653 at commit 2d32ea3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AngersZhuuuu
Copy link
Contributor Author

Change to resolve in #25542 .

srowen pushed a commit that referenced this pull request Sep 27, 2019
…ing SessionState for built-in Hive 2.3

### What changes were proposed in this pull request?

Hive 2.3 will set a new UDFClassLoader to hiveConf.classLoader when initializing SessionState since HIVE-11878,  and
1. ADDJarCommand will add jars to clientLoader.classLoader.
2. --jar passed jar will be added to clientLoader.classLoader
3.  jar passed by hive conf  `hive.aux.jars`  [SPARK-28954](#25653) [SPARK-28840](#25542) will be added to clientLoader.classLoader too

For these  reason we cannot load the jars added by ADDJarCommand because of class loader got changed. We reset it to clientLoader.ClassLoader here.

### Why are the changes needed?
support for jdk11

### Does this PR introduce any user-facing change?
NO

### How was this patch tested?
UT
```
export JAVA_HOME=/usr/lib/jdk-11.0.3
export PATH=$JAVA_HOME/bin:$PATH

build/sbt -Phive-thriftserver -Phadoop-3.2

hive/test-only *HiveSparkSubmitSuite -- -z "SPARK-8368: includes jars passed in through --jars"
hive-thriftserver/test-only *HiveThriftBinaryServerSuite -- -z "test add jar"
```

Closes #25775 from AngersZhuuuu/SPARK-29015-STS-JDK11.

Authored-by: angerszhu <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants