silundong commented on code in PR #4471:
URL: https://github.com/apache/calcite/pull/4471#discussion_r2215614400


##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -11087,4 +11087,14 @@ private void 
checkLoptOptimizeJoinRule(LoptOptimizeJoinRule rule) {
         .withRule(CoreRules.FULL_TO_LEFT_AND_RIGHT_JOIN)
         .checkUnchanged();
   }
+
+  @Test void testAggregateFilterToCase() {
+    final String sql = "select\n"
+        + " sum(sal) filter(where deptno = 10) as sum_match,\n"
+        + " sum(distinct empno) filter(where deptno = 20) as 
sum_distinct_not_match,\n"

Review Comment:
   Ok, I will add a case for SUM0. However, this rule does not convert 
   `SUM0(cnt) FILTER (x = 'foo')` 
   to 
   `SUM0(CASE WHEN x = 'foo' THEN cnt ELSE 0 END)`, 
   but to 
   `SUM0(CASE WHEN x = 'foo' THEN cnt END)`. 
   They are equivalent.



-- 
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]

Reply via email to