You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2021/07/30 07:28:22 UTC

[GitHub] [carbondata] marchpure commented on a change in pull request #4186: [CARBONDATA-4255] Prohibit Create/Drop Database when databaselocation is inconsistent

marchpure commented on a change in pull request #4186:
URL: https://github.com/apache/carbondata/pull/4186#discussion_r679711854



##########
File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/deleteTable/TestDeleteTableNewDDL.scala
##########
@@ -58,6 +65,35 @@ class TestDeleteTableNewDDL extends QueryTest with BeforeAndAfterAll {
     }.getMessage.contains("Database 'dropdb_test' not found"))
   }
 
+  test("test create database when dblocation is inconsistent") {
+    val dbName = "dropdb_test"
+    sql(s"drop database if exists $dbName cascade")
+    CarbonProperties.getInstance().addProperty(CarbonCommonConstants.STORE_LOCATION,
+      warehouse + File.separator + "carbonwarehouse")
+    val exception = intercept[InvalidOperationException] {
+      sql(s"create database $dbName")
+    }
+    assert(exception.getMessage.contains("Create database is prohibited when" +
+      " database locaton is inconsistent, please don't configure " +
+      " carbon.storelocation and spark.sql.warehouse.dir to different values"))
+    CarbonProperties.getInstance().addProperty(CarbonCommonConstants.STORE_LOCATION, warehouse)
+  }
+
+  test("test drop database when dblocation is inconsistent") {
+    val dbName = "dropdb_test"
+    sql(s"drop database if exists $dbName cascade")
+    sql(s"create database $dbName")
+    CarbonProperties.getInstance().addProperty(CarbonCommonConstants.STORE_LOCATION,
+      warehouse + File.separator + "carbonwarehouse")
+    val exception = intercept[InvalidOperationException] {

Review comment:
       I will raise a pr to avoid mk empty dir under table creation.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@carbondata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org