@@ -46,6 +46,10 @@ object SparkSubmit {
4646 private val CLUSTER = 2
4747 private val ALL_DEPLOY_MODES = CLIENT | CLUSTER
4848
49+ // A special jar name that indicates the class being run is inside of Spark itself, and therefore
50+ // no user jar is needed.
51+ private val SPARK_INTERNAL = " spark-internal"
52+
4953 // Special primary resource names that represent shells rather than application jars.
5054 private val SPARK_SHELL = " spark-shell"
5155 private val PYSPARK_SHELL = " pyspark-shell"
@@ -257,7 +261,9 @@ object SparkSubmit {
257261 // In yarn-cluster mode, use yarn.Client as a wrapper around the user class
258262 if (clusterManager == YARN && deployMode == CLUSTER ) {
259263 childMainClass = " org.apache.spark.deploy.yarn.Client"
260- childArgs += (" --jar" , args.primaryResource)
264+ if (args.primaryResource != SPARK_INTERNAL ) {
265+ childArgs += (" --jar" , args.primaryResource)
266+ }
261267 childArgs += (" --class" , args.mainClass)
262268 if (args.childArgs != null ) {
263269 args.childArgs.foreach { arg => childArgs += (" --arg" , arg) }
@@ -332,7 +338,7 @@ object SparkSubmit {
332338 * Return whether the given primary resource represents a user jar.
333339 */
334340 private def isUserJar (primaryResource : String ): Boolean = {
335- ! isShell(primaryResource) && ! isPython(primaryResource)
341+ ! isShell(primaryResource) && ! isPython(primaryResource) && ! isInternal(primaryResource)
336342 }
337343
338344 /**
@@ -349,6 +355,10 @@ object SparkSubmit {
349355 primaryResource.endsWith(" .py" ) || primaryResource == PYSPARK_SHELL
350356 }
351357
358+ private [spark] def isInternal (primaryResource : String ): Boolean = {
359+ primaryResource == SPARK_INTERNAL
360+ }
361+
352362 /**
353363 * Merge a sequence of comma-separated file lists, some of which may be null to indicate
354364 * no files, into a single comma-separated string.
0 commit comments