Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/12081#discussion_r60665413
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
---
@@ -348,4 +363,99 @@ class HiveDDLSuite extends QueryTest with SQLTestUtils
with TestHiveSingleton {
}
}
}
+
+ test("create/drop database - location") {
+ val catalog = sqlContext.sessionState.catalog
+ withTempDir { tmpDir =>
+ val dbName = "db1"
+ val tabName = "tab1"
+ val path = catalog.createDatabasePath(dbName,
Option(tmpDir.toString))
+ val fs = new
Path(path).getFileSystem(hiveContext.sessionState.hiveconf)
+ withTable(tabName) {
+ assert(tmpDir.listFiles.isEmpty)
+ sql(s"CREATE DATABASE $dbName Location '$tmpDir'")
+ val db1 = catalog.getDatabaseMetadata(dbName)
+ assert(db1 == CatalogDatabase(
+ dbName,
+ "",
+ path,
+ Map.empty))
+ sql("USE db1")
--- End diff --
Are we switching back to the original db after the test?
---
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]