@@ -161,7 +161,7 @@ private[hive] class HiveClientImpl(
161161 // HiveConf is a Hadoop Configuration, which has a field of classLoader and
162162 // the initial value will be the current thread's context class loader
163163 // (i.e. initClassLoader at here).
164- // We call initialConf .setClassLoader(initClassLoader) at here to make
164+ // We call hiveConf .setClassLoader(initClassLoader) at here to make
165165 // this action explicit.
166166 hiveConf.setClassLoader(initClassLoader)
167167
@@ -190,6 +190,12 @@ private[hive] class HiveClientImpl(
190190 if (clientLoader.cachedHive != null ) {
191191 Hive .set(clientLoader.cachedHive.asInstanceOf [Hive ])
192192 }
193+ // For hive version higher then 2.3, when we initial SessionState, it will set
194+ // a new UDFClassLoader to hiveConf's classLoader, when we use ADDJarCommand to
195+ // add jar, it will be added to clientLoader.classLoader, then the jar won't be find
196+ // in hiveConf's ClassLoader, here we rest it with clientLoader.ClassLoader which contains
197+ // jars passed by --jars loaded by main thread ClassLoader. Thus we can load all jars
198+ // passed by --jars and AddJarCommand.
193199 state.getConf.setClassLoader(initClassLoader)
194200 SessionState .start(state)
195201 state.out = new PrintStream (outputBuffer, true , UTF_8 .name())
0 commit comments