Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/17154#discussion_r104270279 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -268,16 +268,19 @@ private[hive] class HiveClientImpl( */ def withHiveState[A](f: => A): A = retryLocked { val original = Thread.currentThread().getContextClassLoader - // Set the thread local metastore client to the client associated with this HiveClientImpl. - Hive.set(client) + val originalConfLoader = state.getConf.getClassLoader // The classloader in clientLoader could be changed after addJar, always use the latest // classloader + Thread.currentThread().setContextClassLoader(clientLoader.classLoader) state.getConf.setClassLoader(clientLoader.classLoader) + // Set the thread local metastore client to the client associated with this HiveClientImpl. + Hive.set(client) // setCurrentSessionState will use the classLoader associated // with the HiveConf in `state` to override the context class loader of the current // thread. shim.setCurrentSessionState(state) val ret = try f finally { + state.getConf.setClassLoader(originalConfLoader) --- End diff -- why we set it back? where we change it?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org