Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/12081#discussion_r61991201
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
---
@@ -348,4 +364,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 = "file:" + catalog.createDatabasePath(dbName,
Option(tmpDir.toString))
+ val fs = new
Path(path).getFileSystem(hiveContext.sessionState.newHadoopConf())
+ withTable(tabName) {
+ assert(tmpDir.listFiles.isEmpty)
+ sql(s"CREATE DATABASE $dbName Location '$tmpDir'")
--- End diff --
The directory will be dropped by the Hive metastore API. The test case
verified this behavior.
https://github.com/gatorsmile/spark/blob/mkdir/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala#L394
---
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]