Skip to content

Commit b085f10

Browse files
committed
Make sure that empty string is filtered out when we get secondary jars
1 parent 3cc1085 commit b085f10

File tree

2 files changed

+4
-5
lines changed
  • yarn
    • alpha/src/main/scala/org/apache/spark/deploy/yarn
    • stable/src/main/scala/org/apache/spark/deploy/yarn

2 files changed

+4
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class Client(args: ClientArguments, conf: Configuration, sparkConf: SparkConf)
263263
}
264264

265265
// handle any add jars
266-
var cachedSecondaryJarLinks = ListBuffer.empty[String]
266+
val cachedSecondaryJarLinks = ListBuffer.empty[String]
267267
if ((args.addJars != null) && (!args.addJars.isEmpty())){
268268
args.addJars.split(',').foreach { case file: String =>
269269
val localURI = new URI(file.trim())
@@ -496,7 +496,7 @@ object Client {
496496
}
497497

498498
val cachedSecondaryJarLinks =
499-
sparkConf.getOption(CONF_SPARK_YARN_SECONDARY_JARS).getOrElse("").split(",")
499+
sparkConf.getOption(CONF_SPARK_YARN_SECONDARY_JARS).getOrElse("").split(",").filter(_.nonEmpty)
500500

501501
// Normally the users app.jar is last in case conflicts with spark jars
502502
val userClasspathFirst = sparkConf.get("spark.yarn.user.classpath.first", "false").toBoolean

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,10 @@ object Client {
510510
}
511511

512512
val cachedSecondaryJarLinks =
513-
sparkConf.getOption(CONF_SPARK_YARN_SECONDARY_JARS).getOrElse("").split(",")
513+
sparkConf.getOption(CONF_SPARK_YARN_SECONDARY_JARS).getOrElse("").split(",").filter(_.nonEmpty)
514514

515515
// Normally the users app.jar is last in case conflicts with spark jars
516-
val userClasspathFirst = sparkConf.get("spark.yarn.user.classpath.first", "false")
517-
.toBoolean
516+
val userClasspathFirst = sparkConf.get("spark.yarn.user.classpath.first", "false").toBoolean
518517
if (userClasspathFirst) {
519518
Apps.addToEnvironment(env, Environment.CLASSPATH.name, Environment.PWD.$() +
520519
Path.SEPARATOR + APP_JAR)

0 commit comments

Comments
 (0)