@@ -251,17 +251,19 @@ object SparkSubmit {
251251 }
252252
253253 val isYarnCluster = clusterManager == YARN && deployMode == CLUSTER
254- if (args.packagesResolved != null ) {
255- args.jars = mergeFileLists(args.jars, args.packagesResolved)
256- if (args.isPython) args.pyFiles = mergeFileLists(args.pyFiles, args.packagesResolved)
257- } else {
258- // This part needs to be added in case SparkSubmitDriverBootstrapper is not called
259- val resolvedMavenCoordinates =
260- SparkSubmitUtils .resolveMavenCoordinates(
261- args.packages, Option (args.repositories), Option (args.ivyRepoPath)).mkString(" ," )
262- if (resolvedMavenCoordinates.trim.length > 0 ) {
263- args.jars = mergeFileLists(args.jars, resolvedMavenCoordinates)
264- if (args.isPython) args.pyFiles = mergeFileLists(args.pyFiles, resolvedMavenCoordinates)
254+ val packagesResolved =
255+ if (args.packagesResolved != null ) {
256+ // SparkSubmitDriverBootstrapper already downloaded the jars for us
257+ args.packagesResolved
258+ } else {
259+ SparkSubmitUtils .resolveMavenCoordinates(args.packages, Option (args.repositories),
260+ Option (args.ivyRepoPath)).mkString(" ," )
261+ }
262+
263+ if (packagesResolved.nonEmpty) {
264+ args.jars = mergeFileLists(args.jars, packagesResolved)
265+ if (args.isPython) {
266+ args.pyFiles = mergeFileLists(args.pyFiles, packagesResolved)
265267 }
266268 }
267269
@@ -713,7 +715,7 @@ private[spark] object SparkSubmitUtils {
713715 * after a '!' by Ivy. It also sometimes contains '(bundle)' after '.jar'. Remove that as well.
714716 * @param artifacts Sequence of dependencies that were resolved and retrieved
715717 * @param cacheDirectory directory where jars are cached
716- * @return a comma-delimited list of paths for the dependencies
718+ * @return A sequence of paths for the dependencies
717719 */
718720 private [spark] def resolveDependencyPaths (
719721 artifacts : Array [AnyRef ],
@@ -778,7 +780,7 @@ private[spark] object SparkSubmitUtils {
778780 * @param coordinates Comma-delimited string of maven coordinates
779781 * @param remoteRepos Comma-delimited string of remote repositories other than maven central
780782 * @param ivyPath The path to the local ivy repository
781- * @return The comma-delimited path to the jars of the given maven artifacts including their
783+ * @return A sequence of paths to the jars of the given maven artifacts including their
782784 * transitive dependencies
783785 */
784786 private [spark] def resolveMavenCoordinates (
@@ -787,7 +789,7 @@ private[spark] object SparkSubmitUtils {
787789 ivyPath : Option [String ],
788790 isTest : Boolean = false ): Seq [String ] = {
789791 if (coordinates == null || coordinates.trim.isEmpty) {
790- Seq ( " " )
792+ Seq .empty
791793 } else {
792794 val sysOut = System .out
793795 // To prevent ivy from logging to system out
0 commit comments