Skip to content

Commit

Permalink
[CARBONDATA-3467] Fix count(*) with filter on string column
Browse files Browse the repository at this point in the history
  • Loading branch information
Indhumathi27 committed Jul 9, 2019
1 parent 8f0ec97 commit 1315735
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
plan.transform {
case aggregate@Aggregate(grp, aExp, child) =>
// check for if plan is for dataload for preaggregate table, then skip applying mv
if (aExp.exists(p => p.name.equals("preAggLoad") || p.name.equals("preAgg"))) {
if (aExp.exists(p =>
!p.isInstanceOf[UnresolvedAlias] && (p.name.equals("preAggLoad") ||
p.name.equals("preAgg")))) {
needAnalysis = false
}
Aggregate(grp, aExp, child)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,16 @@ class TestAllOperationsOnMV extends QueryTest with BeforeAndAfterEach {
newSet
}

test("test count(*) with filter") {
sql("drop table if exists test")
sql("create table test(id int, name string, id1 string, id2 string, dob timestamp, doj " +
"timestamp, v1 bigint, v2 bigint, v3 decimal(30,10), v4 decimal(20,10), v5 double, v6 " +
"double ) stored by 'carbondata'")
sql("insert into test values(1, 'abc', 'id001', 'id002', '2017-01-01 00:00:00','2017-01-01 " +
"00:00:00', 234, 2242,12.4,23.4,2323,455 )")
checkAnswer(sql("select count(*) from test where id1 < id2"), Seq(Row(1)))
sql("drop table if exists test")
}

}

0 comments on commit 1315735

Please sign in to comment.