LakeShen commented on code in PR #3367:
URL: https://github.com/apache/calcite/pull/3367#discussion_r1313824184


##########
core/src/test/java/org/apache/calcite/test/JdbcTest.java:
##########
@@ -3773,6 +3774,35 @@ public void checkOrderBy(final boolean desc,
             "empid=110; name=Theodore");
   }
 
+  @Test void testExceptToDistinct() {
+    final String sql = ""
+        + "select \"empid\", \"name\" from \"hr\".\"emps\" where 
\"deptno\"=10\n"
+        + "except\n"
+        + "select \"empid\", \"name\" from \"hr\".\"emps\" where 
\"empid\">=150";
+    CalciteAssert.hr()
+        .query(sql)
+        .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner ->
+            planner.removeRule(ENUMERABLE_MINUS_RULE))

Review Comment:
   > Can you elaborate on why you need to exclude this rule in the test?
   
   Hi @asolimando ,because in CalcitePrepareImpl#createPlanner method,it uses 
the VolcanoPlanner,and the MinusToDistinctRule and EnumerableMinusRule are 
added in VolcanoPlanner,the final plan space is as follows:
   
![image](https://github.com/apache/calcite/assets/8057451/bdecf09d-5d8d-493f-9363-3ef021b43159)
   
   EnumerableMinus plan cost is less than the plan which is rewrited by 
MinusToDistinctRule,so I remove the EnumerableMinusRule,MinusToDistinctRule is 
generally used as the RBO rule.



-- 
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: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to