diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java index 4a64610fab..b48e429ccf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java @@ -65,7 +65,7 @@ public class InnerJoinLAsscomProject extends OneExplorationRuleFactory { GroupPlan a = bottomJoin.left(); GroupPlan b = bottomJoin.right(); GroupPlan c = topJoin.right(); - Set cOutputSet = c.getOutputSet(); + Set cExprIdSet = c.getOutputExprIdSet(); /* ********** Split projects ********** */ Map> map = JoinReorderUtils.splitProjection(projects, b); @@ -95,15 +95,16 @@ public class InnerJoinLAsscomProject extends OneExplorationRuleFactory { // Add all slots used by OnCondition when projects not empty. Set aExprIdSet = JoinReorderUtils.combineProjectAndChildExprId(a, aProjects); Map> abOnUsedSlots = Stream.concat( - bottomJoin.getHashJoinConjuncts().stream(), - bottomJoin.getHashJoinConjuncts().stream()) + newTopHashConjuncts.stream(), + newTopOtherConjuncts.stream()) .flatMap(onExpr -> onExpr.getInputSlots().stream()) + .filter(slot -> !cExprIdSet.contains(slot.getExprId())) .collect(Collectors.partitioningBy( slot -> aExprIdSet.contains(slot.getExprId()), Collectors.toSet())); JoinReorderUtils.addSlotsUsedByOn(abOnUsedSlots.get(true), aProjects); JoinReorderUtils.addSlotsUsedByOn(abOnUsedSlots.get(false), bProjects); - aProjects.addAll(cOutputSet); + aProjects.addAll(c.getOutput()); /* ********** new Plan ********** */ LogicalJoin newBottomJoin = topJoin.withConjunctsChildren(newBottomHashConjuncts,