Skip to content

Commit

Permalink
Merge pull request apache#363 from palantir/filter-empty-jars
Browse files Browse the repository at this point in the history
Sanitize empty strings for jars and files
  • Loading branch information
mccheah authored Apr 18, 2018
2 parents 136574e + d9e2332 commit 18acf6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,17 @@ private[spark] class DriverConfigOrchestrator(
None
}

val sparkJars = sparkConf.getOption("spark.jars")
val sparkJars = (sparkConf.getOption("spark.jars")
.map(_.split(","))
.getOrElse(Array.empty[String]) ++
additionalMainAppJar.toSeq
additionalMainAppJar.toSeq)
.map(_.trim)
.filterNot(_.isEmpty)
val sparkFiles = sparkConf.getOption("spark.files")
.map(_.split(","))
.getOrElse(Array.empty[String])
.map(_.trim)
.filterNot(_.isEmpty)

// TODO(SPARK-23153): remove once submission client local dependencies are supported.
if (existSubmissionLocalFiles(sparkJars)) {
Expand Down Expand Up @@ -142,7 +146,7 @@ private[spark] class DriverConfigOrchestrator(
}

private def existSubmissionLocalFiles(files: Seq[String]): Boolean = {
files.exists { uri =>
files.nonEmpty && files.exists { uri =>
Utils.resolveURI(uri).getScheme == "file"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DriverConfigOrchestratorSuite extends SparkFunSuite {
}

sparkConf.set("spark.files", "/path/to/file1,/path/to/file2")
.set("spark.jars", "")
orchestrator = new DriverConfigOrchestrator(
APP_ID,
KUBERNETES_RESOURCE_PREFIX,
Expand Down

0 comments on commit 18acf6d

Please sign in to comment.