vanzin commented on a change in pull request #25910: [SPARK-28762][CORE] Read 
JAR main class if JAR is not located in local file system
URL: https://github.com/apache/spark/pull/25910#discussion_r335649431
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
 ##########
 @@ -203,6 +204,52 @@ private[spark] class SparkSubmit extends Logging {
     }
   }
 
+  /**
+   * Tries to read the mainClass from the JAR manifest if not already set.
+   *
+   * Works with non-local JARs as well.
+   *
+   * @param args Spark submit arguments
+   * @param hadoopConf Hadoop configuration
+   * @param jarPath Path to JAR file, can be remote
+   * @return the FQDN of the main class or null if not found
+   */
+  private def resolveMainClassIfNeeded(
+    args: SparkSubmitArguments,
+    hadoopConf: HadoopConfiguration,
+    jarPath: String
+  ): String = {
+    if (args.mainClass != null) {
+      return args.mainClass
+    }
+
+    var mainClass: String = null
+    if (args.mainClass == null && !args.isPython && !args.isR && jarPath != 
null) {
 
 Review comment:
   Checking `args.mainClass` is redundant here. It also feels like the other 
checks for R and Python don't really belong here.
   
   This method would be better if all it did was get the main class from a jar 
file (regardless of whether the file is local or remote).

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