LakshSingla commented on a change in pull request #12182:
URL: https://github.com/apache/druid/pull/12182#discussion_r789379836
##########
File path: sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
##########
@@ -2143,6 +2143,93 @@ public void testHavingOnExactCountDistinct() throws
Exception
);
}
+ @Test
+ public void testExactCountDistinctWithFilter() throws Exception
+ {
+
+ final String sqlQuery = "SELECT COUNT(DISTINCT foo.dim1) FILTER(WHERE
foo.cnt = 1), SUM(foo.cnt) FROM druid.foo";
+ // When useApproximateCountDistinct=true and
useGroupingSetForExactDistinct=false, planning fails due
+ // to a bug in the Calcite's rule (AggregateExpandDistinctAggregatesRule)
+ try {
+ testQuery(
+ PLANNER_CONFIG_NO_HLL, // Enable exact count distinct
+ sqlQuery,
+ CalciteTests.REGULAR_USER_AUTH_RESULT,
+ ImmutableList.of(),
+ ImmutableList.of()
+ );
+ }
+ catch (RuntimeException e) {
+ Assert.assertTrue(e.getMessage().contains("Error while applying rule
AggregateExpandDistinctAggregatesRule"));
Review comment:
Thanks, I missed this. I can add an `Assert.fails()` right after the
`testQuery` in try block to ensure that the exception is always thrown.
--
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]