- 
                Notifications
    You must be signed in to change notification settings 
- Fork 28.9k
[SPARK-29015][SQL][test-hadoop3.2]Reset class loader after initializing SessionState for built-in Hive 2.3 #25775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c3de557
              2cf3153
              e5cd06c
              569ab8a
              edaf402
              7ec01e4
              098a432
              07dd32e
              35f0a01
              fb39a53
              a510a23
              bc73663
              f772e49
              c213b07
              c751ce6
              6e70b74
              a02d0b6
              01122e3
              340e0b6
              35c961f
              f30d001
              4db3b54
              8e17346
              f37335c
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -161,7 +161,7 @@ private[hive] class HiveClientImpl( | |
| // HiveConf is a Hadoop Configuration, which has a field of classLoader and | ||
| // the initial value will be the current thread's context class loader | ||
| // (i.e. initClassLoader at here). | ||
| // We call initialConf.setClassLoader(initClassLoader) at here to make | ||
| // We call hiveConf.setClassLoader(initClassLoader) at here to make | ||
| // this action explicit. | ||
| hiveConf.setClassLoader(initClassLoader) | ||
|  | ||
|  | @@ -190,6 +190,13 @@ private[hive] class HiveClientImpl( | |
| if (clientLoader.cachedHive != null) { | ||
| Hive.set(clientLoader.cachedHive.asInstanceOf[Hive]) | ||
| } | ||
| // Hive 2.3 will set UDFClassLoader to hiveConf when initializing SessionState | ||
| // since HIVE-11878, and ADDJarCommand will add jars to clientLoader.classLoader. | ||
| // For this reason we cannot load the jars added by ADDJarCommand because of class loader | ||
| // got changed. We reset it to clientLoader.ClassLoader here. | ||
| if (HiveUtils.isHive23) { | ||
| state.getConf.setClassLoader(clientLoader.classLoader) | ||
| } | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gatorsmile @srowen @HyukjinKwon @dongjoon-hyun @juliuszsompolski Do you have more comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No opinion from me, I know too little context of how these classloaders should be used to review. | ||
| SessionState.start(state) | ||
|         
                  wangyum marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| state.out = new PrintStream(outputBuffer, true, UTF_8.name()) | ||
| state.err = new PrintStream(outputBuffer, true, UTF_8.name()) | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not set the classLoader blindly to
clientLoader.classLoader? HIVE-11878 got merged into hive 1.3.0 and 2.0.0? This issue can still exist in the production environment when we try to use non-builtin hive libraries.cc @ulysses-you @cloud-fan @wangyum @AngersZhuuuu