This is an automated email from the ASF dual-hosted git repository. englefly pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 7f06cf0a012 check pushDownContext validation after withNewProbeExpression() (#34704) 7f06cf0a012 is described below commit 7f06cf0a0125d84c41e1edbb71366e293f70239d Author: minghong <engle...@gmail.com> AuthorDate: Sun May 12 18:05:15 2024 +0800 check pushDownContext validation after withNewProbeExpression() (#34704) when the runtime filter target to a constant, the PushDownContext.finalTarget is null. in this case, do not pushdown runtime filter. example: select * from (select 1 as x from T1) T2 join T3 on T2.x=T3.x when push down RF(T3.x->T2.x) inside "select 1 as x from T1", the column x is a constant, and the pushDown stopped. --- .../processor/post/RuntimeFilterPushDownVisitor.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java index f268d1ab8b5..7cadbde1768 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java @@ -103,9 +103,14 @@ public class RuntimeFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownC this.exprOrder = exprOrder; this.isNot = isNot; Expression expr = getSingleNumericSlotOrExpressionCoveredByCast(probeExpr); + /* finalTarget can be null if it is not a column from base table. + for example: + select * from T1 join (select 9 as x) T2 on T1.x=T2.x, + where the final target of T2.x is a constant + */ if (expr instanceof Slot) { probeSlot = (Slot) expr; - finalTarget = rfContext.getAliasTransferPair((Slot) probeSlot); + finalTarget = rfContext.getAliasTransferPair(probeSlot); } else { finalTarget = null; probeSlot = null; @@ -289,6 +294,9 @@ public class RuntimeFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownC } for (Expression prob : probExprList) { PushDownContext ctxForChild = prob.equals(ctx.probeExpr) ? ctx : ctx.withNewProbeExpression(prob); + if (!ctxForChild.isValid()) { + continue; + } if (ctx.rfContext.isRelationUseByPlan(leftNode, ctxForChild.finalTarget.first)) { pushed |= leftNode.accept(this, ctxForChild); } @@ -363,8 +371,11 @@ public class RuntimeFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownC } } } - - return project.child().accept(this, ctxProjectProbeExpr); + if (!ctxProjectProbeExpr.isValid()) { + return false; + } else { + return project.child().accept(this, ctxProjectProbeExpr); + } } @Override @@ -401,7 +412,7 @@ public class RuntimeFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownC * +--->select 0, 0 * push down context for "select 0, 0" is invalid */ - pushedDown |= setOperation.child(i).accept(this, ctx.withNewProbeExpression(newProbeExpr)); + pushedDown |= setOperation.child(i).accept(this, childPushDownContext); } } return pushedDown; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org