Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2197#discussion_r183199499
--- Diff:
integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggregateTableSelection.scala
---
@@ -379,6 +382,68 @@ class TestPreAggregateTableSelection extends
SparkQueryTest with BeforeAndAfterA
checkAnswer(df, Seq(Row(10,10.0)))
}
+ test("explain query") {
+ sql("explain select name,sum(age) from mainTable where name = 'a'
group by name").show(false)
+ var rows = sql("explain select name,sum(age) from mainTable where name
= 'a' group by name").collect()
+ assertResult(
+ """== CarbonData Profiler ==
+ |Query rewrite based on DataMap:
+ | - agg1 (preaggregate)
+ |Table Scan on maintable_agg1
+ | - filter: (maintable_name <> null and maintable_name = a)
+ | - pruned by main index
+ | - all blocklets: 1
+ | - skipped blocklets: 1
+ |""".stripMargin)(rows(0).getString(0))
+
+ rows = sql("explain select name,sum(age) from mainTable group by
name").collect()
+ assertResult(
+ """== CarbonData Profiler ==
+ |Query rewrite based on DataMap:
+ | - agg1 (preaggregate)
+ |Table Scan on maintable_agg1
+ | - filter: None
+ | - all blocklets: 1
+ | - skipped blocklets: 0
+ |""".stripMargin)(rows(0).getString(0))
+ }
+
+ test("explain query with lucene datamap") {
--- End diff --
better to move this testcase to lucene module or add a separate testsuite
for profile
---