From 50855f01c75f830cee31163ece1c14def679bfe0 Mon Sep 17 00:00:00 2001 From: minghong Date: Tue, 30 Apr 2024 18:48:50 +0800 Subject: [PATCH] [fix](nereids) when runtimefilter target is null, skip the rf #34358 --- .../trees/plans/physical/PhysicalHashJoin.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java index d1a554820f..e2472db87c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java @@ -251,8 +251,16 @@ public class PhysicalHashJoin< Pair srcPair = ctx.getAliasTransferMap().get(srcExpr); PhysicalRelation srcNode = (srcPair == null) ? null : srcPair.first; Pair targetPair = ctx.getAliasTransferMap().get(probeExpr); - // when probeExpr is output slot of setOperator, targetPair is null - PhysicalRelation target1 = (targetPair == null) ? null : targetPair.first; + if (targetPair == null) { + /* cases for "targetPair is null" + 1. when probeExpr is output slot of setOperator, targetPair is null + 2. join (topn(table1), table2) + when aliasTransferMap goes through topn, all slots from table1 + are cleared to avoid generate rf(table2->table1) + */ + return false; + } + PhysicalRelation target1 = targetPair.first; PhysicalRelation target2 = null; if (ConnectContext.get() != null && ConnectContext.get().getSessionVariable().expandRuntimeFilterByInnerJoin) { if (!this.equals(builderNode)