kgyrtkirk commented on code in PR #3735:
URL: https://github.com/apache/calcite/pull/3735#discussion_r1557794102
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -2149,6 +2149,29 @@ private void
checkSemiOrAntiJoinProjectTranspose(JoinRelType type) {
.check();
}
+ @Test void testDistinctWithFilterWithoutGroupByUsingJoin() {
+ final String sql = "SELECT SUM(comm), COUNT(DISTINCT sal) FILTER (WHERE
sal > 1000)\n"
+ + "FROM emp";
+ sql(sql)
+ .withRule(CoreRules.AGGREGATE_EXPAND_DISTINCT_AGGREGATES_TO_JOIN)
+ .check();
+ }
+
+ @Test void testMultipleDistinctWithSameArgsDifferentFilterUsingJoin() {
+ final String sql = "select deptno, "
+ + "count(distinct sal) FILTER (WHERE sal > 1000), "
+ + "count(distinct sal) FILTER (WHERE sal > 500) "
+ + "from sales.emp group by deptno";
+ sql(sql)
+ .withRule(
+ CoreRules.AGGREGATE_EXPAND_DISTINCT_AGGREGATES_TO_JOIN,
+ CoreRules.AGGREGATE_PROJECT_MERGE
+ )
+ .check();
+
+ testSortUnionTranspose();
Review Comment:
this call to `testSortUnionTranspose` seem to invoke another test
now I see that this was there by mistake in [some earlier
comment](https://github.com/apache/calcite/pull/3735#discussion_r1528352739) -
its not necessary
--
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]