swuferhong commented on code in PR #21530:
URL: https://github.com/apache/flink/pull/21530#discussion_r1065269586


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RewriteMultiJoinConditionRule.scala:
##########
@@ -45,7 +48,12 @@ class RewriteMultiJoinConditionRule
     // currently only supports all join types are INNER join
     val isAllInnerJoin = multiJoin.getJoinTypes.forall(_ eq JoinRelType.INNER)
     val (equiJoinFilters, _) = partitionJoinFilters(multiJoin)
-    !multiJoin.isFullOuterJoin && isAllInnerJoin && equiJoinFilters.size > 1
+    val numJoinInputs = multiJoin.getInputs.size()
+    val dpThreshold = ShortcutUtils
+      .unwrapContext(multiJoin)
+      .getTableConfig
+      .get(OptimizerConfigOptions.TABLE_OPTIMIZER_BUSHY_JOIN_REORDER_THRESHOLD)
+    (numJoinInputs > dpThreshold) && !multiJoin.isFullOuterJoin && 
isAllInnerJoin && equiJoinFilters.size > 1

Review Comment:
   For bushy join reorder, this is no need to rewrite multi join condition to 
avoid increasing the search base of the bushy join reorder algorithm, but it 
will not bring more possible join pairs for bushy join. Like `A J B J C`, `A 
and B` have join condition,  `B and C` have join condition. 
`RewriteMultiJoinConditionRule` will add a new condition `A and C`: this is 
useful for Lopt join rule, but for bushy join rule,  the condition `A and B` 
and  `B and C` can get two three-tables join reorder result( `(A J B) J C` and 
`(B J C) J A`, and only one `A J B J C` result will be retained). Btw, I will 
add comment for why will do it.



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to