Github user xuchuanyin commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2491#discussion_r202000836 --- Diff: integration/spark2/src/test/scala/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapSuite.scala --- @@ -377,7 +382,91 @@ class BloomCoarseGrainDataMapSuite extends QueryTest with BeforeAndAfterAll with checkQuery("fakeDm", shouldHit = false) } + test("test blocl change datatype for bloomfilter index datamap") { + sql( + s""" + | CREATE TABLE $normalTable(id INT, name STRING, city STRING, age INT, + | s1 STRING, s2 STRING, s3 STRING, s4 STRING, s5 STRING, s6 STRING, s7 STRING, s8 STRING) + | STORED BY 'carbondata' TBLPROPERTIES('table_blocksize'='128') + | """.stripMargin) + + sql( + s""" + | CREATE DATAMAP $dataMapName ON TABLE $normalTable + | USING 'bloomfilter' WITH DEFERRED REBUILD + | DMProperties( 'INDEX_COLUMNS'='city,id', 'BLOOM_SIZE'='640000') + """.stripMargin) + val exception: MalformedCarbonCommandException = intercept[MalformedCarbonCommandException] { + sql(s"ALTER TABLE $normalTable CHANGE id id bigint") + } + assert(exception.getMessage + .contains("alter table change datatype is not supported for index datamap")) + } + + test("test drop index columns for bloomfilter datamap") { + sql( + s""" + | CREATE TABLE $normalTable(id INT, name STRING, city STRING, age INT, + | s1 STRING, s2 STRING, s3 STRING, s4 STRING, s5 STRING, s6 STRING, s7 STRING, s8 STRING) + | STORED BY 'carbondata' TBLPROPERTIES('table_blocksize'='128') + | """.stripMargin) + sql( + s""" + | CREATE DATAMAP $dataMapName ON TABLE $normalTable + | USING 'bloomfilter' + | WITH DEFERRED REBUILD + | DMProperties('INDEX_COLUMNS'='city,id', 'BLOOM_SIZE'='640000') + """.stripMargin) + val exception: MalformedCarbonCommandException = intercept[MalformedCarbonCommandException] { + sql(s"alter table $normalTable drop columns(name, id)") + } + assert(exception.getMessage + .contains("alter table drop column is not supported for index datamap")) + } + + test("test create bloomfilter datamap which index column is localdictcolumn ") { + sql( + s""" + | CREATE TABLE $normalTable(id INT, name STRING, city STRING, age INT, + | s1 STRING, s2 STRING, s3 STRING, s4 STRING, s5 STRING, s6 STRING, s7 STRING, s8 STRING) + | STORED BY 'carbondata' TBLPROPERTIES('local_dictionary_enable'='true', + | 'local_dictionary_include'='city') + | """.stripMargin) + val exception: MalformedDataMapCommandException = intercept[MalformedDataMapCommandException] { + sql( + s""" + | CREATE DATAMAP $dataMapName ON TABLE $normalTable + | USING 'bloomfilter' + | WITH DEFERRED REBUILD + | DMProperties('INDEX_COLUMNS'='city,id', 'BLOOM_SIZE'='640000') + """.stripMargin) + } + assert(exception.getMessage + .contains("cannot be localDictColumn")) + } + + test("test create bloomfilter datamap which index column datatype is complex ") { + sql( + s""" + | CREATE TABLE $normalTable(id INT, name STRING, city Array<INT>, age INT, + | s1 STRING, s2 STRING, s3 STRING, s4 STRING, s5 STRING, s6 STRING, s7 STRING, s8 STRING) + | STORED BY 'carbondata' + | """.stripMargin) + val exception: MalformedDataMapCommandException = intercept[MalformedDataMapCommandException] { + sql( + s""" + | CREATE DATAMAP $dataMapName ON TABLE $normalTable + | USING 'bloomfilter' + | WITH DEFERRED REBUILD + | DMProperties('INDEX_COLUMNS'='city,id', 'BLOOM_SIZE'='640000') + """.stripMargin) + } + assert(exception.getMessage --- End diff -- please optimize the indent
---