-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-19137][SQL] Fix withSQLConf to reset OptionalConfigEntry correctly
#16522
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
Conversation
|
Looks ok since this is what other tests here do; but I wonder why this case isn't handled in |
|
@dongjoon-hyun The expected behavior is this test should use a temp folder instead. Looks like it gets |
|
I found the root cause. |
withSQLConf to reset OptionalConfigEntry correctly
| val currentValues = keys.map(key => Try(spark.conf.get(key)).toOption) | ||
| val currentValues = keys.map { key => | ||
| if (spark.conf.contains(key)) { | ||
| Try(spark.conf.get(key)).toOption |
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.
Nit: you can just use Some(spark.conf.get(key)). It's better to not hide exceptions from get.
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.
Sure!
|
Thank you. I updated it. |
|
Test build #71099 has finished for PR 16522 at commit
|
|
Test build #71106 has finished for PR 16522 at commit
|
|
Test build #71107 has finished for PR 16522 at commit
|
| protected def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = { | ||
| val (keys, values) = pairs.unzip | ||
| val currentValues = keys.map(key => Try(spark.conf.get(key)).toOption) | ||
| val currentValues = keys.map { key => |
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.
I think this can just be keys.flatMap(conf.get). But I'll let Ryan look since he's more involved with this code.
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.
I see. Thank you, @vanzin .
Could you ping him?
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.
You already did.
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. You meant @zsxwing . I see.
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.
@vanzin conf.get won't work as it will use defaultValueString when the key doesn't exist.
|
LGTM. Merging to master and 2.1. |
…orrectly
## What changes were proposed in this pull request?
`DataStreamReaderWriterSuite` makes test files in source folder like the followings. Interestingly, the root cause is `withSQLConf` fails to reset `OptionalConfigEntry` correctly. In other words, it resets the config into `Some(undefined)`.
```bash
$ git status
Untracked files:
(use "git add <file>..." to include in what will be committed)
sql/core/%253Cundefined%253E/
sql/core/%3Cundefined%3E/
```
## How was this patch tested?
Manual.
```
build/sbt "project sql" test
git status
```
Author: Dongjoon Hyun <[email protected]>
Closes #16522 from dongjoon-hyun/SPARK-19137.
(cherry picked from commit d5b1dc9)
Signed-off-by: Shixiong Zhu <[email protected]>
…orrectly
## What changes were proposed in this pull request?
`DataStreamReaderWriterSuite` makes test files in source folder like the followings. Interestingly, the root cause is `withSQLConf` fails to reset `OptionalConfigEntry` correctly. In other words, it resets the config into `Some(undefined)`.
```bash
$ git status
Untracked files:
(use "git add <file>..." to include in what will be committed)
sql/core/%253Cundefined%253E/
sql/core/%3Cundefined%3E/
```
## How was this patch tested?
Manual.
```
build/sbt "project sql" test
git status
```
Author: Dongjoon Hyun <[email protected]>
Closes apache#16522 from dongjoon-hyun/SPARK-19137.
…orrectly
## What changes were proposed in this pull request?
`DataStreamReaderWriterSuite` makes test files in source folder like the followings. Interestingly, the root cause is `withSQLConf` fails to reset `OptionalConfigEntry` correctly. In other words, it resets the config into `Some(undefined)`.
```bash
$ git status
Untracked files:
(use "git add <file>..." to include in what will be committed)
sql/core/%253Cundefined%253E/
sql/core/%3Cundefined%3E/
```
## How was this patch tested?
Manual.
```
build/sbt "project sql" test
git status
```
Author: Dongjoon Hyun <[email protected]>
Closes apache#16522 from dongjoon-hyun/SPARK-19137.
What changes were proposed in this pull request?
DataStreamReaderWriterSuitemakes test files in source folder like the followings. Interestingly, the root cause iswithSQLConffails to resetOptionalConfigEntrycorrectly. In other words, it resets the config intoSome(undefined).How was this patch tested?
Manual.