morrySnow commented on code in PR #32214: URL: https://github.com/apache/doris/pull/32214#discussion_r1524495784
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushDownProjectThroughSemiJoin.java: ########## @@ -72,12 +75,27 @@ public List<Rule> buildRules() { .whenNot(j -> j.right().child().hasDistributeHint()) .then(topJoin -> { LogicalProject<LogicalJoin<GroupPlan, GroupPlan>> project = topJoin.right(); + if (projectBothJoinSide(project)) { + return null; + } Plan newRight = pushdownProject(project); return topJoin.withChildren(topJoin.left(), newRight); }).toRule(RuleType.PUSH_DOWN_PROJECT_THROUGH_SEMI_JOIN_RIGHT) ); } + private boolean projectBothJoinSide(LogicalProject<LogicalJoin<GroupPlan, GroupPlan>> project) { + // if project contains both side of join, it can't be pushed. + // such as: Review Comment: select ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushDownProjectThroughSemiJoin.java: ########## @@ -72,12 +75,27 @@ public List<Rule> buildRules() { .whenNot(j -> j.right().child().hasDistributeHint()) .then(topJoin -> { LogicalProject<LogicalJoin<GroupPlan, GroupPlan>> project = topJoin.right(); + if (projectBothJoinSide(project)) { + return null; + } Plan newRight = pushdownProject(project); return topJoin.withChildren(topJoin.left(), newRight); }).toRule(RuleType.PUSH_DOWN_PROJECT_THROUGH_SEMI_JOIN_RIGHT) ); } + private boolean projectBothJoinSide(LogicalProject<LogicalJoin<GroupPlan, GroupPlan>> project) { + // if project contains both side of join, it can't be pushed. + // such as: Review Comment: select -- 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