Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1743#discussion_r159606692
--- Diff:
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datamap/TestDataMapCommand.scala
---
@@ -76,6 +78,31 @@ class TestDataMapCommand extends QueryTest with
BeforeAndAfterAll {
assert(dataMapSchemaList.get(2).getChildSchema.getTableName.equals("datamaptest_datamap3"))
}
+ test("check hivemetastore after drop datamap") {
+ try {
+ CarbonProperties.getInstance()
+ .addProperty(CarbonCommonConstants.ENABLE_HIVE_SCHEMA_META_STORE,
+ "true")
+ sql("drop datamap if exists datamap_hiveMetaStoreTable on table
hiveMetaStoreTable")
+ sql("drop table if exists hiveMetaStoreTable")
+ sql("create table hiveMetaStoreTable (a string, b string, c string)
stored by 'carbondata'")
+
+ sql(
+ "create datamap datamap_hiveMetaStoreTable on table
hiveMetaStoreTable using 'preaggregate' dmproperties('key'='value') as select
count(a) from hiveMetaStoreTable")
+ checkExistence(sql("show datamap on table hiveMetaStoreTable"),
true, "datamap_hiveMetaStoreTable")
+
+ sql("drop datamap datamap_hiveMetaStoreTable on table
hiveMetaStoreTable")
+ checkExistence(sql("show datamap on table hiveMetaStoreTable"),
false, "datamap_hiveMetaStoreTable")
+
+ }
+ finally {
+ sql("drop table hiveMetaStoreTable")
+ CarbonProperties.getInstance()
+ .addProperty(CarbonCommonConstants.ENABLE_HIVE_SCHEMA_META_STORE,
+ CarbonCommonConstants.ENABLE_HIVE_SCHEMA_META_STORE_DEFAULT)
+ }
+ }
+
--- End diff --
Beside CarbonDropDataMapCommand.scala, CarbonDropTableCommand.scala also
has problem that processMetadata is incorrect if there are datamaps associated
with the fact table. Please modify that in this PR also and add testcase
---