Indhumathi27 commented on a change in pull request #4186:
URL: https://github.com/apache/carbondata/pull/4186#discussion_r679068488
##########
File path:
integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateTableIfNotExists.scala
##########
@@ -44,6 +46,42 @@ class TestCreateTableIfNotExists extends QueryTest with
BeforeAndAfterAll {
}
}
+ test("test create table with consistent table location") {
+ val dbName = "testdb"
+ val tblName = "testtbl"
+ sql(s"drop database if exists $dbName cascade")
+ val dblocation = warehouse + File.separator + dbName
+ sql(s"create database $dbName location '$dblocation'")
+ sql(s"use $dbName")
+
+ // here, we make sure the carbontablepath contains uuid
+ val tbllocation = dblocation + File.separator + tblName
+ new File(tbllocation).mkdir()
+ assert(new File(tbllocation).exists())
+
+ sql(s"create table $tblName(a int, b string) stored as carbondata")
+ val tblIdentifier = new TableIdentifier(tblName)
+ val carbonTablePath =
CarbonEnv.getInstance(sqlContext.sparkSession).carbonMetaStore
+
.lookupRelation(tblIdentifier)(sqlContext.sparkSession).carbonTable.getTablePath
+
+ // assert the carbontablepath contains uuid
+ assert(!carbonTablePath.equals(tbllocation))
+
+ val sparkTablePath =
+ sqlContext.sparkSession.sessionState.catalog
+ .getTableMetadata(tblIdentifier).storage.locationUri.get.getPath
+ assert(carbonTablePath.equals(sparkTablePath))
+
+ sql(s"drop table $tblName")
+ assert(!new File(carbonTablePath).exists())
+
+ /*
Review comment:
If this issue is not fixed, you can raise JIRA and track it later. can
remove this testcase from this PR
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]