wangyum commented on a change in pull request #25775: 
[SPARK-29015][SQL][test-hadoop3.2]Reset class loader after initializing 
SessionState for built-in Hive 2.3
URL: https://github.com/apache/spark/pull/25775#discussion_r328408451
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
 ##########
 @@ -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)
+    }
     SessionState.start(state)
 
 Review comment:
   @AngersZhuuuu I think we need to add another test case simily to 
[`HiveSparkSubmitSuite#SPARK-8368: includes jars passed in through 
--jars`](https://github.com/apache/spark/blob/016e1b491c9099063df8e2e76bc58d64fc369490/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSparkSubmitSuite.scala#L110-L127)
 but with `spark.sql.hive.metastore.version=3.1` and 
`spark.sql.hive.metastore.jars=maven`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to