AngersZhuuuu commented on a change in pull request #25944: [SPARK-29254][SQL]
Failed to include jars passed in through --jars when isolatedLoader is enabled
URL: https://github.com/apache/spark/pull/25944#discussion_r328892707
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/IsolatedClientLoader.scala
##########
@@ -80,10 +80,21 @@ private[hive] object IsolatedClientLoader extends Logging {
resolvedVersions((resolvedVersion, actualHadoopVersion))
}
+ // HiveMetastoreConnection using maven missed the jars in classpath which
passed
+ // through --jars. They need to be added back before new
IsolatedClientLoader()
+ val jarsInClasspath = Utils.getContextOrSparkClassLoader match {
+ case m: MutableURLClassLoader =>
+ val jars = m.getURLs.toSeq
+ logInfo(s"Added jars in classpath to IsolatedClientLoader: $jars")
+ jars
+ case _ =>
+ Seq.empty
+ }
+
new IsolatedClientLoader(
hiveVersion(hiveMetastoreVersion),
sparkConf,
- execJars = files,
+ execJars = files ++ jarsInClasspath,
Review comment:
I have some small point:
1. jar passed by --jars or `spark.jars` will be set to
`SparkContext.getActive.get.listJars()`
2. mabe we need consider java version problem as
https://github.com/apache/spark/blob/9f3c82163a52c3d4cef9580d4c4a692754163281/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala#L350
3. The Third way to create IsolatedClientLoader will have same problem.
https://github.com/apache/spark/blob/9f3c82163a52c3d4cef9580d4c4a692754163281/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala#L391
----------------------------------------------------------------
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]