Skip to content

Commit c7d1aee

Browse files
committed
follow comment
1 parent e09d8e0 commit c7d1aee

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ private[spark] class SparkSubmit extends Logging {
304304
// Resolve maven dependencies if there are any and add classpath to jars. Add them to py-files
305305
// too for packages that include Python code
306306
val resolvedMavenCoordinates = DependencyUtils.resolveMavenDependencies(
307-
packagesTransitive = true, args.packagesExclusions, args.packages,
308-
args.repositories, args.ivyRepoPath, args.ivySettingsPath)
307+
packagesTransitive = true, Option(args.packagesExclusions), Option(args.packages),
308+
Option(args.repositories), Option(args.ivyRepoPath), args.ivySettingsPath)
309309

310310
if (resolvedMavenCoordinates.nonEmpty) {
311311
// In K8s client mode, when in the driver, add resolved jars early as we might need
@@ -589,7 +589,7 @@ private[spark] class SparkSubmit extends Logging {
589589
OptionAssigner(args.deployMode, ALL_CLUSTER_MGRS, ALL_DEPLOY_MODES,
590590
confKey = SUBMIT_DEPLOY_MODE.key),
591591
OptionAssigner(args.name, ALL_CLUSTER_MGRS, ALL_DEPLOY_MODES, confKey = "spark.app.name"),
592-
OptionAssigner(args.ivyRepoPath.orNull, ALL_CLUSTER_MGRS, CLIENT, confKey = "spark.jars.ivy"),
592+
OptionAssigner(args.ivyRepoPath, ALL_CLUSTER_MGRS, CLIENT, confKey = "spark.jars.ivy"),
593593
OptionAssigner(args.driverMemory, ALL_CLUSTER_MGRS, CLIENT,
594594
confKey = DRIVER_MEMORY.key),
595595
OptionAssigner(args.driverExtraClassPath, ALL_CLUSTER_MGRS, ALL_DEPLOY_MODES,
@@ -605,13 +605,13 @@ private[spark] class SparkSubmit extends Logging {
605605
OptionAssigner(args.pyFiles, ALL_CLUSTER_MGRS, CLUSTER, confKey = SUBMIT_PYTHON_FILES.key),
606606

607607
// Propagate attributes for dependency resolution at the driver side
608-
OptionAssigner(args.packages.orNull, STANDALONE | MESOS | KUBERNETES,
608+
OptionAssigner(args.packages, STANDALONE | MESOS | KUBERNETES,
609609
CLUSTER, confKey = "spark.jars.packages"),
610-
OptionAssigner(args.repositories.orNull, STANDALONE | MESOS | KUBERNETES,
610+
OptionAssigner(args.repositories, STANDALONE | MESOS | KUBERNETES,
611611
CLUSTER, confKey = "spark.jars.repositories"),
612-
OptionAssigner(args.ivyRepoPath.orNull, STANDALONE | MESOS | KUBERNETES,
612+
OptionAssigner(args.ivyRepoPath, STANDALONE | MESOS | KUBERNETES,
613613
CLUSTER, confKey = "spark.jars.ivy"),
614-
OptionAssigner(args.packagesExclusions.orNull, STANDALONE | MESOS | KUBERNETES,
614+
OptionAssigner(args.packagesExclusions, STANDALONE | MESOS | KUBERNETES,
615615
CLUSTER, confKey = "spark.jars.excludes"),
616616

617617
// Yarn only
@@ -647,7 +647,7 @@ private[spark] class SparkSubmit extends Logging {
647647
confKey = DRIVER_CORES.key),
648648
OptionAssigner(args.supervise.toString, STANDALONE | MESOS, CLUSTER,
649649
confKey = DRIVER_SUPERVISE.key),
650-
OptionAssigner(args.ivyRepoPath.orNull, STANDALONE, CLUSTER, confKey = "spark.jars.ivy"),
650+
OptionAssigner(args.ivyRepoPath, STANDALONE, CLUSTER, confKey = "spark.jars.ivy"),
651651

652652
// An internal option used only for spark-shell to add user jars to repl's classloader,
653653
// previously it uses "spark.jars" or "spark.yarn.dist.jars" which now may be pointed to

core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ private[deploy] class SparkSubmitArguments(args: Seq[String], env: Map[String, S
6060
var name: String = null
6161
var childArgs: ArrayBuffer[String] = new ArrayBuffer[String]()
6262
var jars: String = null
63-
var packages: Option[String] = None
64-
var repositories: Option[String] = None
65-
var ivyRepoPath: Option[String] = None
63+
var packages: String = null
64+
var repositories: String = null
65+
var ivyRepoPath: String = null
6666
var ivySettingsPath: Option[String] = None
67-
var packagesExclusions: Option[String] = None
67+
var packagesExclusions: String = null
6868
var verbose: Boolean = false
6969
var isPython: Boolean = false
7070
var pyFiles: String = null
@@ -185,11 +185,13 @@ private[deploy] class SparkSubmitArguments(args: Seq[String], env: Map[String, S
185185
files = Option(files).orElse(sparkProperties.get(config.FILES.key)).orNull
186186
archives = Option(archives).orElse(sparkProperties.get(config.ARCHIVES.key)).orNull
187187
pyFiles = Option(pyFiles).orElse(sparkProperties.get(config.SUBMIT_PYTHON_FILES.key)).orNull
188-
ivyRepoPath = sparkProperties.get("spark.jars.ivy")
188+
ivyRepoPath = sparkProperties.get("spark.jars.ivy").orNull
189189
ivySettingsPath = sparkProperties.get("spark.jars.ivySettings")
190-
packages = packages.orElse(sparkProperties.get("spark.jars.packages"))
191-
packagesExclusions = packagesExclusions.orElse(sparkProperties.get("spark.jars.excludes"))
192-
repositories = repositories.orElse(sparkProperties.get("spark.jars.repositories"))
190+
packages = Option(packages).orElse(sparkProperties.get("spark.jars.packages")).orNull
191+
packagesExclusions = Option(packagesExclusions)
192+
.orElse(sparkProperties.get("spark.jars.excludes")).orNull
193+
repositories = Option(repositories)
194+
.orElse(sparkProperties.get("spark.jars.repositories")).orNull
193195
deployMode = Option(deployMode)
194196
.orElse(sparkProperties.get(config.SUBMIT_DEPLOY_MODE.key))
195197
.orElse(env.get("DEPLOY_MODE"))
@@ -407,13 +409,13 @@ private[deploy] class SparkSubmitArguments(args: Seq[String], env: Map[String, S
407409
jars = Utils.resolveURIs(value)
408410

409411
case PACKAGES =>
410-
packages = Some(value)
412+
packages = value
411413

412414
case PACKAGES_EXCLUDE =>
413-
packagesExclusions = Some(value)
415+
packagesExclusions = value
414416

415417
case REPOSITORIES =>
416-
repositories = Some(value)
418+
repositories = value
417419

418420
case CONF =>
419421
val (confName, confValue) = SparkSubmitUtils.parseSparkConfProperty(value)

0 commit comments

Comments
 (0)