Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Jan 9, 2017

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).

$ 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

@vanzin
Copy link
Contributor

vanzin commented Jan 9, 2017

Looks ok since this is what other tests here do; but I wonder why this case isn't handled in StreamingQueryManager.scala; it seems to either throw an error or create a new temp directory, but not to create a new directory under the CWD as is the case here.

@zsxwing
Copy link
Member

zsxwing commented Jan 9, 2017

@dongjoon-hyun The expected behavior is this test should use a temp folder instead. Looks like it gets <undefined> from some place.

@dongjoon-hyun
Copy link
Member Author

Oh, I see. Then, I'll look inside the temp folder generation code and fix that.
Thank you for review, @vanzin and @zsxwing .

@dongjoon-hyun
Copy link
Member Author

I found the root cause.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-19137][SQL][SS] Garbage left in source tree after SQL tests ran [SPARK-19137][SQL] Fix withSQLConf to reset OptionalConfigEntry correctly Jan 10, 2017
@dongjoon-hyun
Copy link
Member Author

Hi, @vanzin and @zsxwing .
It was a bug of withSQLConf.
I think this is correct fix, but we need to see the result of whole result because this is test utility issue.

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure!

@dongjoon-hyun
Copy link
Member Author

Thank you. I updated it.

@SparkQA
Copy link

SparkQA commented Jan 10, 2017

Test build #71099 has finished for PR 16522 at commit bddaa64.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 10, 2017

Test build #71106 has finished for PR 16522 at commit efcfb81.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 10, 2017

Test build #71107 has finished for PR 16522 at commit eceffcb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

Hi, @vanzin and @zsxwing .
The PR passes the tests. Could you review this PR again?

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 =>
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

You already did.

Copy link
Member Author

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.

Copy link
Member

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.

@zsxwing
Copy link
Member

zsxwing commented Jan 10, 2017

LGTM. Merging to master and 2.1.

asfgit pushed a commit that referenced this pull request Jan 10, 2017
…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]>
@asfgit asfgit closed this in d5b1dc9 Jan 10, 2017
@dongjoon-hyun
Copy link
Member Author

Thank you, @zsxwing and @vanzin !

uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…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.
cmonkey pushed a commit to cmonkey/spark that referenced this pull request Feb 15, 2017
…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.
@dongjoon-hyun dongjoon-hyun deleted the SPARK-19137 branch January 7, 2019 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants