godfreyhe commented on a change in pull request #8832: [FLINK-12937] 
[table-planner-blink] Introduce join reorder planner rules in blink planner
URL: https://github.com/apache/flink/pull/8832#discussion_r299350051
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/optimize/program/FlinkBatchProgram.scala
 ##########
 @@ -135,6 +137,24 @@ object FlinkBatchProgram {
             .build(), "prune empty after predicate push down")
         .build())
 
+    // join reorder
+    if 
(config.getBoolean(PlannerConfigOptions.SQL_OPTIMIZER_JOIN_REORDER_ENABLED)) {
+      chainedProgram.addLast(
+        JOIN_REORDER,
+        FlinkGroupProgramBuilder.newBuilder[BatchOptimizeContext]
+          .addProgram(FlinkHepRuleSetProgramBuilder.newBuilder
+            .setHepRulesExecutionType(HEP_RULES_EXECUTION_TYPE.RULE_COLLECTION)
+            .setHepMatchOrder(HepMatchOrder.BOTTOM_UP)
+            .add(FlinkBatchRuleSets.JOIN_REORDER_PERPARE_RULES)
+            .build(), "merge join into MultiJoin")
+          .addProgram(FlinkHepRuleSetProgramBuilder.newBuilder
+            .setHepRulesExecutionType(HEP_RULES_EXECUTION_TYPE.RULE_SEQUENCE)
+            .setHepMatchOrder(HepMatchOrder.BOTTOM_UP)
+            .add(FlinkBatchRuleSets.JOIN_REORDER_RULES)
 
 Review comment:
   yes. if we put join reorder rules into LOGICAL_RULES with volcano planner, 
the search space of joins trees is too large. and the join reorder rule 
(`LoptOptimizeJoinRule`) will also choose the best plan based cost even in hep 
planner.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to