xiedeyantu commented on PR #4361:
URL: https://github.com/apache/calcite/pull/4361#issuecomment-2856765546

   > not sure what you mean by "hard coding" I have approved
   
   I tried to execute this case in JdbcTest and found that 3-way INTERSECT 
triggered the rule, but it was abandoned by Volcano because of its high cost. 
Then I'll squash commit first, and then deal with other problems if they arise?
   ```
     @Test void testIntersectToSemiJoin2() {
       final String sql = ""
           + "select a from (values (1.0), (2.0), (3.0), (4.0), (5.0)) as t1 
(a)\n" +
           "intersect\n" +
           "select a from (values (1), (2)) as t2 (a)\n" +
           "intersect\n" +
           "select a from (values (1.0), (4.0), (null)) as t3 (a)";
       CalciteAssert.hr()
           .query(sql)
           .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>)
               planner -> {
                 List<RelOptRule> rules = planner.getRules();
                 for (RelOptRule rule : rules) {
                   planner.removeRule(rule);
                 }
                 planner.addRule(CoreRules.INTERSECT_TO_SEMI_JOIN);
                 planner.addRule(EnumerableRules.ENUMERABLE_JOIN_RULE);
                 planner.addRule(EnumerableRules.ENUMERABLE_VALUES_RULE);
                 planner.addRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE);
                 planner.addRule(EnumerableRules.ENUMERABLE_CALC_RULE);
                 planner.addRule(EnumerableRules.ENUMERABLE_PROJECT_RULE);
                 planner.addRule(EnumerableRules.ENUMERABLE_FILTER_RULE);
                 planner.addRule(CoreRules.INTERSECT_MERGE);
                 planner.addRule(CoreRules.INTERSECT_TO_SEMI_JOIN);
               })
           .explainContains("")
           .returnsUnordered("A=1.0");
     }
   ```
   
![graphviz](https://github.com/user-attachments/assets/8151af86-a199-43d5-b53b-382f48c2d688)
   


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