Skip to content

Commit 3bb44b4

Browse files
committed
minor fix
1 parent 7feae6e commit 3bb44b4

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -517,17 +517,15 @@ private[spark] class Client(
517517
*/
518518
val cachedSecondaryJarLinks = ListBuffer.empty[String]
519519
List(
520-
(sparkConf.get(JARS_TO_DISTRIBUTE).orNull, LocalResourceType.FILE, true),
521-
(sparkConf.get(FILES_TO_DISTRIBUTE).orNull, LocalResourceType.FILE, false),
522-
(sparkConf.get(ARCHIVES_TO_DISTRIBUTE).orNull, LocalResourceType.ARCHIVE, false)
520+
(sparkConf.get(JARS_TO_DISTRIBUTE), LocalResourceType.FILE, true),
521+
(sparkConf.get(FILES_TO_DISTRIBUTE), LocalResourceType.FILE, false),
522+
(sparkConf.get(ARCHIVES_TO_DISTRIBUTE), LocalResourceType.ARCHIVE, false)
523523
).foreach { case (flist, resType, addToClasspath) =>
524-
if (flist != null && !flist.isEmpty()) {
525-
flist.split(',').foreach { file =>
526-
val (_, localizedPath) = distribute(file, resType = resType)
527-
require(localizedPath != null)
528-
if (addToClasspath) {
529-
cachedSecondaryJarLinks += localizedPath
530-
}
524+
flist.foreach { file =>
525+
val (_, localizedPath) = distribute(file, resType = resType)
526+
require(localizedPath != null)
527+
if (addToClasspath) {
528+
cachedSecondaryJarLinks += localizedPath
531529
}
532530
}
533531
}
@@ -1264,7 +1262,7 @@ private object Client extends Logging {
12641262

12651263
val secondaryJars =
12661264
if (args != null) {
1267-
getSecondaryJarUris(sparkConf.get(JARS_TO_DISTRIBUTE).map(_.split(",").toSeq))
1265+
getSecondaryJarUris(Option(sparkConf.get(JARS_TO_DISTRIBUTE)))
12681266
} else {
12691267
getSecondaryJarUris(sparkConf.get(SECONDARY_JARS))
12701268
}

yarn/src/main/scala/org/apache/spark/deploy/yarn/config.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,18 @@ package object config {
8585

8686
private[spark] val ARCHIVES_TO_DISTRIBUTE = ConfigBuilder("spark.yarn.dist.archives")
8787
.stringConf
88-
.optional
88+
.toSequence
89+
.withDefault(Nil)
8990

9091
private[spark] val FILES_TO_DISTRIBUTE = ConfigBuilder("spark.yarn.dist.files")
9192
.stringConf
92-
.optional
93+
.toSequence
94+
.withDefault(Nil)
9395

9496
private[spark] val JARS_TO_DISTRIBUTE = ConfigBuilder("spark.yarn.dist.jars")
9597
.stringConf
96-
.optional
98+
.toSequence
99+
.withDefault(Nil)
97100

98101
private[spark] val PRESERVE_STAGING_FILES = ConfigBuilder("spark.yarn.preserve.staging.files")
99102
.doc("Whether to preserve temporary files created by the job in HDFS.")

0 commit comments

Comments
 (0)