xuchuanyin / workbench

0 stars 0 forks source link

2018-07-13 localdict with bloom index #53

Open xuchuanyin opened 6 years ago

xuchuanyin commented 6 years ago

test("test bloom datamap: bloom index column is local dictionary") { sql( s""" | CREATE TABLE $normalTable(c1 string, c2 int, c3 string) | STORED BY 'carbondata' """.stripMargin) // c1 is local dictionary and will create bloom index on it sql( s""" | CREATE TABLE $bloomDMSampleTable(c1 string, c2 int, c3 string) | STORED BY 'carbondata' | TBLPROPERTIES('local_dictionary_include'='c1', 'local_dictionary_threshold'='1000') """.stripMargin) sql( s""" | CREATE DATAMAP $dataMapName on table $bloomDMSampleTable | using 'bloomfilter' | DMPROPERTIES('index_columns'='c1, c2') """.stripMargin) sql(s"INSERT INTO $bloomDMSampleTable values ('c1v11', 11, 'c3v11'), ('c1v12', 12, 'c3v12')") sql(s"INSERT INTO $normalTable values ('c1v11', 11, 'c3v11'), ('c1v12', 12, 'c3v12')") checkAnswer(sql(s"select from $bloomDMSampleTable"), sql(s"select from $normalTable")) checkAnswer(sql(s"select from $bloomDMSampleTable where c1 = 'c1v12'"), sql(s"select from $normalTable where c1 = 'c1v12'")) }