Github user kevinjmh commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2598#discussion_r207458031
--- Diff:
integration/spark2/src/test/scala/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapSuite.scala
---
@@ -219,6 +220,62 @@ class BloomCoarseGrainDataMapSuite extends QueryTest
with BeforeAndAfterAll with
sql(s"DROP TABLE IF EXISTS $bloomDMSampleTable")
}
+ test("test using search mode to query tabel with bloom 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 TABLE $bloomDMSampleTable(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)
+
+ // load two segments
+ (1 to 2).foreach { i =>
+ sql(
+ s"""
+ | LOAD DATA LOCAL INPATH '$bigFile' INTO TABLE $normalTable
+ | OPTIONS('header'='false')
+ """.stripMargin)
+ sql(
+ s"""
+ | LOAD DATA LOCAL INPATH '$bigFile' INTO TABLE
$bloomDMSampleTable
+ | OPTIONS('header'='false')
+ """.stripMargin)
+ }
+
+ sql(
+ s"""
+ | CREATE DATAMAP $dataMapName ON TABLE $bloomDMSampleTable
+ | USING 'bloomfilter'
+ | DMProperties('INDEX_COLUMNS'='city,id', 'BLOOM_SIZE'='640000')
+ """.stripMargin)
+
+ checkExistence(sql(s"SHOW DATAMAP ON TABLE $bloomDMSampleTable"),
true, dataMapName)
+
+ // get answer before search mode is enable
+ val expectedAnswer1 = sql(s"select * from $normalTable where id =
1").collect()
+ val expectedAnswer2 = sql(s"select * from $normalTable where city in
('city_999')").collect()
+
+ carbonSession.startSearchMode()
+ assert(carbonSession.isSearchModeEnabled)
+
+ checkAnswer(
--- End diff --
Question also for `LuceneFineGrainDataMapWithSearchModeSuite`
If we use EXPLAIN command, it won't run in Search Mode.
When we debug this test case, we can see that the query will be pruned in
Master side of search mode using `getSplit` method in CarbonTableInputFormat
which finally using datamap to prune.
So that should be confirm in other test case with same table schema and
data, and take this test case as an extended test only for Search Mode
feature. This test case also does not care about whether the datamap created
before or after data load.
---