jackwener commented on code in PR #10479: URL: https://github.com/apache/doris/pull/10479#discussion_r920969169
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java: ########## @@ -50,11 +51,54 @@ enum SwapType { @Override public Rule<Plan> build() { - return innerLogicalJoin().then(join -> new LogicalJoin( - join.getJoinType().swap(), - join.getCondition(), - join.right(), - join.left()) - ).toRule(RuleType.LOGICAL_JOIN_COMMUTATIVE); + return innerLogicalJoin().then(join -> { + if (check(join)) { + return null; + } + boolean isBottomJoin = isBottomJoin(join); + if (swapType == SwapType.BOTTOM_JOIN && !isBottomJoin) { + return null; + } + + LogicalJoin newJoin = new LogicalJoin( + join.getJoinType(), + join.getCondition(), + join.right(), join.left() + ); + newJoin.getJoinReorderContext().copyFrom(join.getJoinReorderContext()); Review Comment: JoinReorderContext is mutable. Has added it into constructor -- 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...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org