[SPARK-16529][SQL][TEST] withTempDatabase should set default database before dropping#14184
Closed
dongjoon-hyun wants to merge 1 commit intoapache:masterfrom
dongjoon-hyun:SPARK-16529
Closed
[SPARK-16529][SQL][TEST] withTempDatabase should set default database before dropping#14184dongjoon-hyun wants to merge 1 commit intoapache:masterfrom dongjoon-hyun:SPARK-16529
withTempDatabase should set default database before dropping#14184dongjoon-hyun wants to merge 1 commit intoapache:masterfrom
dongjoon-hyun:SPARK-16529
Conversation
…base before dropping
|
Test build #62268 has finished for PR 14184 at commit
|
|
Test build #62272 has finished for PR 14184 at commit
|
Member
Author
|
Hi, @liancheng . It was made by you at 72981bc#diff-e59968489e4f36f43010dd7acd60341dR106 and used in many cases. Recently, SPARK-16459 starts to prevent dropping current database, so we had better update this. |
Contributor
|
LGTM, merging to master and branch-2.0. Thanks! |
asfgit
pushed a commit
that referenced
this pull request
Jul 14, 2016
…base before dropping
## What changes were proposed in this pull request?
`SQLTestUtils.withTempDatabase` is a frequently used test harness to setup a temporary table and clean up finally. This issue improves like the following for usability.
```scala
- try f(dbName) finally spark.sql(s"DROP DATABASE $dbName CASCADE")
+ try f(dbName) finally {
+ if (spark.catalog.currentDatabase == dbName) {
+ spark.sql(s"USE ${DEFAULT_DATABASE}")
+ }
+ spark.sql(s"DROP DATABASE $dbName CASCADE")
+ }
```
In case of forgetting to reset the databaes, `withTempDatabase` will not raise Exception.
## How was this patch tested?
This improves test harness.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #14184 from dongjoon-hyun/SPARK-16529.
(cherry picked from commit c576f9f)
Signed-off-by: Cheng Lian <lian@databricks.com>
Member
Author
|
Oh, thank you, @liancheng ! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
SQLTestUtils.withTempDatabaseis a frequently used test harness to setup a temporary table and clean up finally. This issue improves like the following for usability.In case of forgetting to reset the databaes,
withTempDatabasewill not raise Exception.How was this patch tested?
This improves test harness.