AngersZhuuuu commented on a change in pull request #29966:
URL: https://github.com/apache/spark/pull/29966#discussion_r533123647



##########
File path: core/src/main/scala/org/apache/spark/SparkContext.scala
##########
@@ -1919,18 +1919,24 @@ class SparkContext(config: SparkConf) extends Logging {
           // A JAR file which exists only on the driver node
           case "file" => addLocalJarFile(new File(uri.getPath))
           // A JAR file which exists locally on every worker node
-          case "local" => "file:" + uri.getPath
+          case "local" => Array("file:" + uri.getPath)
+          case "ivy" =>
+            // Since `new Path(path).toUri` will lose query information,
+            // so here we use `URI.create(path)`
+            
DependencyUtils.resolveMavenDependencies(URI.create(path)).split(",")
           case _ => checkRemoteJarFile(path)
         }
       }
-      if (key != null) {
+      if (keys.nonEmpty) {
         val timestamp = if (addedOnSubmit) startTime else 
System.currentTimeMillis
-        if (addedJars.putIfAbsent(key, timestamp).isEmpty) {
-          logInfo(s"Added JAR $path at $key with timestamp $timestamp")
-          postEnvironmentUpdate()
-        } else {
-          logWarning(s"The jar $path has been added already. Overwriting of 
added jars " +
-            "is not supported in the current version.")
+        keys.foreach { key =>
+          if (addedJars.putIfAbsent(key, timestamp).isEmpty) {
+            logInfo(s"Added JAR $path at $key with timestamp $timestamp")
+            postEnvironmentUpdate()
+          } else {
+            logWarning(s"The jar $path has been added already. Overwriting of 
added jars " +

Review comment:
       > If `transitive=true` and there are too many dependencies, users 
possibly see a lot of warning messages?
   
   Also `logInfo(s"Added JAR $path at $key with timestamp $timestamp")`
   
   How about like 
   ```
   val (added, existed) = keys.partition(addedJars.putIfAbsent(_, 
timestamp).isEmpty)
           if (added.nonEmpty) {
             logInfo(s"Added JAR $path at ${added.mkString(",")} with timestamp 
$timestamp")
             postEnvironmentUpdate()
           }
           if(existed.nonEmpty) {
             logWarning(s"The dependencies jars ${existed.mkString(",")} of 
$path has been added" +
               s" already. Overwriting of added jars is not supported in the 
current version.")
           }
   ```
   




----------------------------------------------------------------
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]



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

Reply via email to