LakshSingla commented on a change in pull request #12065:
URL: https://github.com/apache/druid/pull/12065#discussion_r777401695
##########
File path: sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
##########
@@ -13342,4 +13340,34 @@ public void
testCommonVirtualExpressionWithDifferentValueType() throws Exception
ImmutableList.of()
);
}
+
+ // When optimization in Grouping#applyProject is applied, and it reduces a
Group By query to a timeseries, we
+ // want it to return empty bucket if no row matches
+ @Test
+ public void testReturnEmptyRowWhenGroupByIsConvertedToTimeseries() throws
Exception
+ {
+ skipVectorize();
+ testQuery(
+ "SELECT 'A', dim1 from foo WHERE m1 = 50 AND dim1 = 'wat' GROUP BY
dim1",
Review comment:
On removing the `m1=50` clause, the `dim1` is not getting reduced to
`wat` literal in the Calcite planner phase, so the optimization in
`Grouping.java` to eliminate the literals is not getting applied.
I checked the place where this reduction is happening, and it's in the
`ProjectMergeRule` of Calcite. When there's a single project, then
`ProjectMergeRule` is not getting invoked.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]