-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-33912][SQL] Refactor DependencyUtils ivy property parameter #30928
Closed
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
83686af
[SPARK-33912][SQL] Refactor DependencyUtils ivy property parameter
AngersZhuuuu 978e994
Update SparkSubmit.scala
AngersZhuuuu 23d4451
Revert "Update SparkSubmit.scala"
AngersZhuuuu 7da53f2
Update SparkSubmit.scala
AngersZhuuuu e09d8e0
Merge branch 'master' into SPARK-33912
AngersZhuuuu c7d1aee
follow comment
AngersZhuuuu de0eee1
Update DependencyUtils.scala
AngersZhuuuu de1225d
Update DependencyUtils.scala
AngersZhuuuu File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,11 @@ import org.apache.spark.deploy.SparkSubmitUtils | |
import org.apache.spark.internal.Logging | ||
|
||
case class IvyProperties( | ||
packagesExclusions: String, | ||
packages: String, | ||
repositories: String, | ||
ivyRepoPath: String, | ||
ivySettingsPath: String) | ||
packagesExclusions: Option[String], | ||
packages: Option[String], | ||
repositories: Option[String], | ||
ivyRepoPath: Option[String], | ||
ivySettingsPath: Option[String]) | ||
|
||
private[spark] object DependencyUtils extends Logging { | ||
|
||
|
@@ -44,7 +44,7 @@ private[spark] object DependencyUtils extends Logging { | |
"spark.jars.repositories", | ||
"spark.jars.ivy", | ||
"spark.jars.ivySettings" | ||
).map(sys.props.get(_).orNull) | ||
).map(sys.props.get(_)) | ||
IvyProperties(packagesExclusions, packages, repositories, ivyRepoPath, ivySettingsPath) | ||
} | ||
|
||
|
@@ -69,10 +69,10 @@ private[spark] object DependencyUtils extends Logging { | |
* Example: Input: excludeorg.mortbay.jetty:jetty,org.eclipse.jetty:jetty-http | ||
* Output: [org.mortbay.jetty:jetty,org.eclipse.jetty:jetty-http] | ||
*/ | ||
private def parseQueryParams(uri: URI): (Boolean, String) = { | ||
private def parseQueryParams(uri: URI): (Boolean, Option[String]) = { | ||
val uriQuery = uri.getQuery | ||
if (uriQuery == null) { | ||
(false, "") | ||
(false, None) | ||
} else { | ||
val mapTokens = uriQuery.split("&").map(_.split("=")) | ||
if (mapTokens.exists(isInvalidQueryString)) { | ||
|
@@ -103,7 +103,7 @@ private[spark] object DependencyUtils extends Logging { | |
} | ||
excludes | ||
}.mkString(",") | ||
}.getOrElse("") | ||
} | ||
|
||
val validParams = Set("transitive", "exclude") | ||
val invalidParams = groupedParams.keys.filterNot(validParams.contains).toSeq | ||
|
@@ -150,36 +150,36 @@ private[spark] object DependencyUtils extends Logging { | |
resolveMavenDependencies( | ||
transitive, | ||
exclusionList, | ||
authority, | ||
Some(authority), | ||
ivyProperties.repositories, | ||
ivyProperties.ivyRepoPath, | ||
Option(ivyProperties.ivySettingsPath) | ||
ivyProperties.ivySettingsPath | ||
) | ||
} | ||
|
||
def resolveMavenDependencies( | ||
packagesTransitive: Boolean, | ||
packagesExclusions: String, | ||
packages: String, | ||
repositories: String, | ||
ivyRepoPath: String, | ||
packagesExclusions: Option[String], | ||
packages: Option[String], | ||
repositories: Option[String], | ||
ivyRepoPath: Option[String], | ||
ivySettingsPath: Option[String]): Seq[String] = { | ||
val exclusions: Seq[String] = | ||
if (!StringUtils.isBlank(packagesExclusions)) { | ||
packagesExclusions.split(",") | ||
if (packagesExclusions.nonEmpty) { | ||
packagesExclusions.map(_.split(",")).get | ||
} else { | ||
Nil | ||
} | ||
// Create the IvySettings, either load from file or build defaults | ||
val ivySettings = ivySettingsPath match { | ||
case Some(path) => | ||
SparkSubmitUtils.loadIvySettings(path, Option(repositories), Option(ivyRepoPath)) | ||
SparkSubmitUtils.loadIvySettings(path, repositories, ivyRepoPath) | ||
|
||
case None => | ||
SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath)) | ||
SparkSubmitUtils.buildIvySettings(repositories, ivyRepoPath) | ||
} | ||
|
||
SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, | ||
SparkSubmitUtils.resolveMavenCoordinates(packages.get, ivySettings, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yea |
||
transitive = packagesTransitive, exclusions = exclusions) | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use idiomatic Option processing, either a
match
orpackagesExclusions.map(_.split(",")).getOrElse(Nil)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne