-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-14819] [SQL] Improve SET / SET -v command #12583
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
01d3e5a
improve SET / SET -v command
790cfda
remove unused imports
a0de01e
Merge remote-tracking branch 'upstream/master' into SPARK-14819
392327a
Merge remote-tracking branch 'upstream/master' into SPARK-14819
2a077bd
improve the codes and fix test failure
e3ba716
fix the test failure
84243a0
remove unnecessary test case
c6805e4
roll back
99ff8a5
roll back
6c7276b
merge upstream
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -138,17 +138,18 @@ case class SetCommand(kv: Option[(String, Option[String])]) extends RunnableComm | |
| // Queries all key-value pairs that are set in the SQLConf of the sqlContext. | ||
| case None => | ||
| val runFunc = (sqlContext: SQLContext) => { | ||
| sqlContext.getAllConfs.map { case (k, v) => Row(k, v) }.toSeq | ||
| sqlContext.getAllConfs.toSeq.sortBy(_._1).map { case (k, v) => Row(k, v) } ++ | ||
| getEnvList(withDoc = false) | ||
| } | ||
| (keyValueOutput, runFunc) | ||
|
|
||
| // Queries all properties along with their default values and docs that are defined in the | ||
| // SQLConf of the sqlContext. | ||
|
Member
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. We should update the comment regarding the system environment properties. |
||
| case Some(("-v", None)) => | ||
| val runFunc = (sqlContext: SQLContext) => { | ||
| sqlContext.conf.getAllDefinedConfs.map { case (key, defaultValue, doc) => | ||
| sqlContext.conf.getAllDefinedConfs.sortBy(_._1).map { case (key, defaultValue, doc) => | ||
| Row(key, defaultValue, doc) | ||
| } | ||
| } ++ getEnvList(withDoc = true) | ||
| } | ||
| val schema = StructType( | ||
| StructField("key", StringType, nullable = false) :: | ||
|
|
@@ -182,4 +183,18 @@ case class SetCommand(kv: Option[(String, Option[String])]) extends RunnableComm | |
|
|
||
| override def run(sqlContext: SQLContext): Seq[Row] = runFunc(sqlContext) | ||
|
|
||
| /** | ||
| * get the system environment properties as a sequence | ||
|
Member
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. Nit: "get" -> "Gets", "as a sequence" -> "as a sequence of rows". |
||
| * | ||
| * @param withDoc whether the result has a doc column or not | ||
| * @return the sequence of the rows containing the key/value pair of system properties | ||
| */ | ||
| private def getEnvList(withDoc: Boolean) = { | ||
| sys.env.toSeq.sortBy(_._1).map { | ||
| case (k, v) => if (withDoc) Row(s"env:$k", v, "") else Row(s"env:$k", v) | ||
| } ++ | ||
| sys.props.toSeq.sortBy(_._1).map { | ||
| case (k, v) => if (withDoc) Row(s"system:$k", v, "") else Row(s"system:$k", v) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
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.
Same.