You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/01/10 17:28:04 UTC

[GitHub] [calcite] vlsi commented on a change in pull request #1741: [CALCITE-3721] Filter of distinct aggregate call is lost after applyi…

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 very 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:
users@infra.apache.org


With regards,
Apache Git Services