You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/07/13 19:24:20 UTC
[jira] [Updated] (SPARK-16529) SQLTestUtils.withTempDatabase should
set `default` database before dropping
[ https://issues.apache.org/jira/browse/SPARK-16529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dongjoon Hyun updated SPARK-16529:
----------------------------------
Description:
`withTempDatabase` is a frequently used test harness to setup a temporary table and clean up finally. This issue improves like the following for usability.
{code}
- 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")
+ }
{code}
In case of forgetting to reset the databaes, `withTempDatabase` will not raise Exception.
was:
`withTempDatabase` is a frequently used test harness to setup a temporary table and clean up finally. This issue improves like the following for usability.
{code}
- 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")
+ }
{code}
In case of forgetting to reset the databaes, `withTempDatabase` will not raise Exception.
> SQLTestUtils.withTempDatabase should set `default` database before dropping
> ---------------------------------------------------------------------------
>
> Key: SPARK-16529
> URL: https://issues.apache.org/jira/browse/SPARK-16529
> Project: Spark
> Issue Type: Test
> Components: Tests
> Reporter: Dongjoon Hyun
> Priority: Trivial
>
> `withTempDatabase` is a frequently used test harness to setup a temporary table and clean up finally. This issue improves like the following for usability.
> {code}
> - 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")
> + }
> {code}
> In case of forgetting to reset the databaes, `withTempDatabase` will not raise Exception.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org