Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ on:
description: Hadoop version to run with. HADOOP_PROFILE environment variable should accept it.
required: false
type: string
default: hadoop3
default: hadoop2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for test hadoop-2, will revert after confirmation takes effect

envs:
description: Additional environment variables to set when running the tests. Should be in JSON format.
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,8 @@ private[spark] object Client extends Logging {

val SPARK_TESTING = "SPARK_TESTING"

val CLASS_PATH_SEPARATOR = ":"

/**
* Return the path to the given application's staging directory.
*/
Expand Down Expand Up @@ -1470,6 +1472,11 @@ private[spark] object Client extends Logging {
addClasspathEntry(getClusterPath(sparkConf, cp), env)
}

val cpSet = extraClassPath match {
case Some(classPath) => classPath.split(CLASS_PATH_SEPARATOR).toSet
case _ => Set.empty[String]
}

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

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

sys.env.get(ENV_DIST_CLASSPATH).foreach { cp =>
addClasspathEntry(getClusterPath(sparkConf, cp), env)
val newCp = cp.split(CLASS_PATH_SEPARATOR)
.filterNot(cpSet.contains).mkString(CLASS_PATH_SEPARATOR)
addClasspathEntry(getClusterPath(sparkConf, newCp), env)

Copy link
Copy Markdown
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

@LuciferYang LuciferYang Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

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