vlsi commented on a change in pull request #1741: [CALCITE-3721] Filter of 
distinct aggregate call is lost after applyi…
URL: https://github.com/apache/calcite/pull/1741#discussion_r365345915
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
 ##########
 @@ -1474,6 +1474,27 @@ private void 
basePushFilterPastAggWithGroupingSets(boolean unchanged)
     sql(sql).with(program).check();
   }
 
+  @Test public void testDistinctWithFilterWithoutGroupBy() {
+    final String sql = "SELECT SUM(comm), COUNT(DISTINCT comm),\n"
+        + "COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n"
+        + "FROM emp";
+    HepProgram program = new HepProgramBuilder()
+        .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
+        .build();
+    sql(sql).with(program).check();
+  }
+
+  @Test public void testDistinctWithFilterAndGroupBy() {
+    final String sql = "SELECT deptno, SUM(comm), COUNT(DISTINCT comm),\n"
+        + "COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n"
 
 Review comment:
   Is this a minimal reproducible example?
   
   Frankly speaking, it is really hard to follow the code, and it is sad it is 
the most trivial example in the PR.
   
   I would prefer to have a simple example that makes it clear what the rule 
produces. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to