GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/14184
[SPARK-16529][SQL][TEST] `withTempDatabase` should set `default` database
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 {
+ 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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-16529
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14184.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #14184
commit e1fa63757b4a8d1be4439d050df045d8f28b4a4e
Author: Dongjoon Hyun
Date: 2016-07-13T18:51:35Z
[SPARK-16529][SQL][TEST] `withTempDatabase` should set `default` database
before dropping
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---
-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org