Github user dilipbiswal commented on a diff in the pull request:
https://github.com/apache/spark/pull/11991#discussion_r57918497
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
---
@@ -31,9 +31,11 @@ class DDLSuite extends QueryTest with SharedSQLContext {
*/
private def withDatabase(dbNames: String*)(f: => Unit): Unit = {
try f finally {
+ val currentDb = sqlContext.sessionState.catalog.getCurrentDatabase
dbNames.foreach { name =>
sqlContext.sql(s"DROP DATABASE IF EXISTS $name CASCADE")
}
+ sqlContext.sessionState.catalog.setCurrentDatabase(currentDb)
--- End diff --
@gatorsmile Yeah.,initially i was thinking of resetting to "default". I
thought a restore semantics might be better here. Is it possible for us to do
nesting in withDatabase ? Like
WithDatabase("foo") {
// create db
// sql
// withDatabase("bar") {
sql
}
sql
sql
}
Let me know if you want to reset it to "default" instead of restoring ?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]