xzj7019 commented on code in PR #32305: URL: https://github.com/apache/doris/pull/32305#discussion_r1531455069
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PullUpProjectUnderTopN.java: ########## @@ -20,41 +20,52 @@ import org.apache.doris.nereids.properties.OrderKey; import org.apache.doris.nereids.rules.Rule; import org.apache.doris.nereids.rules.RuleType; +import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; import org.apache.doris.nereids.trees.plans.logical.LogicalProject; +import org.apache.doris.nereids.util.ExpressionUtils; import org.apache.doris.nereids.util.PlanUtils; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; /** - * Pull up Project under TopN. + * Pull up Project under TopN for PushDownTopNThroughJoin */ public class PullUpProjectUnderTopN extends OneRewriteRuleFactory { @Override public Rule build() { - return logicalTopN(logicalProject().whenNot(p -> p.isAllSlots())) - .whenNot(topN -> topN.child().hasPushedDownToProjectionFunctions()) + return logicalTopN( + logicalProject(logicalJoin().when(j -> j.getJoinType().isLeftRightOuterOrCrossJoin())) Review Comment: similar question, will it reduce this rule's scope if adding the join pattern judge? -- 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