Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,11 @@ private[spark] object Client extends Logging {
addClasspathEntry(getClusterPath(sparkConf, cp), env)
}

val cpSet = extraClassPath match {
case Some(classPath) if Utils.isTesting => classPath.split(File.pathSeparator).toSet
case _ => Set.empty[String]
}

addClasspathEntry(Environment.PWD.$$(), env)

addClasspathEntry(Environment.PWD.$$() + Path.SEPARATOR + LOCALIZED_CONF_DIR, env)
Expand Down Expand Up @@ -1513,7 +1518,13 @@ private[spark] object Client extends Logging {
}

sys.env.get(ENV_DIST_CLASSPATH).foreach { cp =>
addClasspathEntry(getClusterPath(sparkConf, cp), env)
// SPARK-40635: during the test, add a jar de-duplication process to avoid
// that the startup command can't be executed due to the too long classpath.
val newCp = if (Utils.isTesting) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's add a comment with mentioning the JIRA number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will add comments after the hadoop2 check pass

cp.split(File.pathSeparator)
.filterNot(cpSet.contains).mkString(File.pathSeparator)
} else cp
addClasspathEntry(getClusterPath(sparkConf, newCp), env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to deduplicate jars that have been added to CLASSPATH through extraClassPath

Copy link
Contributor Author

@LuciferYang LuciferYang Oct 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to change it to

      val newCp = if (Utils.isTesting) {
        cp.split(File.pathSeparator)
          .filterNot(cpSet.contains).mkString(File.pathSeparator)
      } else cp

but I think de duplication may also be useful for the production environment

}

// Add the localized Hadoop config at the end of the classpath, in case it contains other
Expand Down