-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-19218][SQL] Fix SET command to show a result correctly and in a sorted order #16579
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
9 commits
Select commit
Hold shift + click to select a range
c182c7d
[SPARK-19218][SQL] SET command should show a sorted result
dongjoon-hyun 2ed6d87
Address comments.
dongjoon-hyun fa4914b
Revert to the approved commit and remove `set -v` test case to avoid …
dongjoon-hyun fb578d1
Add fix and recover `SET -v` test case.
dongjoon-hyun 0214fad
Address comments
dongjoon-hyun 528b0fd
Use Option.
dongjoon-hyun 387ab59
Add `unregister` and use it.
dongjoon-hyun 7061cd9
Remove redundant one.
dongjoon-hyun 7879201
Add a missing clear() while splitting the testcases
dongjoon-hyun 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -982,6 +982,33 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { | |
| spark.sessionState.conf.clear() | ||
| } | ||
|
|
||
| test("SPARK-19218 SET command should show a result in a sorted order") { | ||
| val overrideConfs = sql("SET").collect() | ||
| sql(s"SET test.key3=1") | ||
| sql(s"SET test.key2=2") | ||
| sql(s"SET test.key1=3") | ||
| val result = sql("SET").collect() | ||
| assert(result === | ||
| (overrideConfs ++ Seq( | ||
| Row("test.key1", "3"), | ||
| Row("test.key2", "2"), | ||
| Row("test.key3", "1"))).sortBy(_.getString(0)) | ||
| ) | ||
| spark.sessionState.conf.clear() | ||
| } | ||
|
|
||
| test("SPARK-19218 `SET -v` should not fail with null value configuration") { | ||
| import SQLConf._ | ||
| val confEntry = SQLConfigBuilder("spark.test").doc("doc").stringConf.createWithDefault(null) | ||
|
|
||
| try { | ||
| val result = sql("SET -v").collect() | ||
| assert(result === result.sortBy(_.getString(0))) | ||
| } finally { | ||
|
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: try ... finally seems redundant. |
||
| SQLConf.unregister(confEntry) | ||
| } | ||
| } | ||
|
|
||
| test("SET commands with illegal or inappropriate argument") { | ||
| spark.sessionState.conf.clear() | ||
| // Set negative mapred.reduce.tasks for automatically determining | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
oh, i meant that you actually don't need a try {...} finally {...} here. you don't catch anything.
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.
Ah, I see what you meant. Actually, previously,
SET -vraises exceptions, so this case usetryandcatch. But, as you mentioned, now it's not.Uh oh!
There was an error while loading. Please reload this page.
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.
However, IMO, it's needed to clean up
spark.testif there occurs some regression for this case in the future. For the exceptions in that case, we needs that regression cause test cases failures, socatchis not used here.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.
but you don't catch anything actually? so if any regression in the future, is it different with a try or not? you still see an exception.
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, but we need to clean up spark.test in order not to interfere the other test cases here.
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.
it is failed. isn't it??
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.
:) The point is
the other test casesare still running.Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe, we are confused on terms.
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.
oh, i meant the final Jenkins test result is failed. nvm, i think it is still useful so we can better infer which test causes the failure if we don't interfere other tests.
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.
Oh, I understand. Thanks. :)