englefly commented on code in PR #11812: URL: https://github.com/apache/doris/pull/11812#discussion_r949740485
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/MultiJoin.java: ########## @@ -74,25 +93,30 @@ public Plan reorderJoinsAccordingToConditions() { */ private Plan reorderJoinsAccordingToConditions(List<Plan> joinInputs, List<Expression> conjuncts) { if (joinInputs.size() == 2) { - Set<Slot> joinOutput = getJoinOutput(joinInputs.get(0), joinInputs.get(1)); - Map<Boolean, List<Expression>> split = splitConjuncts(conjuncts, joinOutput); - List<Expression> joinConditions = split.get(true); - List<Expression> nonJoinConditions = split.get(false); - + //Set<Slot> joinOutput = getJoinOutput(joinInputs.get(0), joinInputs.get(1)); + //Map<Boolean, List<Expression>> split = splitConjuncts(conjuncts, joinOutput); + //List<Expression> joinConditions = split.get(true); + //List<Expression> nonJoinConditions = split.get(false); + Pair<List<Expression>, List<Expression>> pair = JoinUtils.extractExpressionForHashTable( + joinInputs.get(0).getOutput().stream().map(SlotReference.class::cast).collect(Collectors.toList()), + joinInputs.get(1).getOutput().stream().map(SlotReference.class::cast).collect(Collectors.toList()), + conjuncts); + List<Expression> joinConditions = pair.first; + conjunctsKeepInFilter = pair.second; LogicalJoin join; if (joinConditions.isEmpty()) { - join = new LogicalJoin(JoinType.CROSS_JOIN, Optional.empty(), joinInputs.get(0), joinInputs.get(1)); + join = new LogicalJoin(JoinType.CROSS_JOIN, + new ArrayList<>(), + Optional.empty(), + joinInputs.get(0), joinInputs.get(1)); } else { join = new LogicalJoin(JoinType.INNER_JOIN, + new ArrayList<>(), Optional.of(ExpressionUtils.and(joinConditions)), Review Comment: MultiJoin runs before FindHashConditionForJoin rule. So all predicates are stored in otherJoinCondition. -- 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