This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new a7b2f8330b [fix](nereids) disable rf for schema scan (#22620)
a7b2f8330b is described below

commit a7b2f8330b7b361078850b3dc579555b4f230a5a
Author: xzj7019 <[email protected]>
AuthorDate: Fri Aug 4 18:54:07 2023 +0800

    [fix](nereids) disable rf for schema scan (#22620)
    
    Forbid runtime filter for schema scan, since be doesn't support.
    Disable other legacy scan type also, only catalog scan(except schema scan) 
and cte is allowed.
---
 .../processor/post/RuntimeFilterGenerator.java     | 26 +++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
index 9450810cf7..22036a073f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
@@ -38,6 +38,7 @@ import 
org.apache.doris.nereids.trees.plans.logical.LogicalCTEConsumer;
 import org.apache.doris.nereids.trees.plans.physical.AbstractPhysicalJoin;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEConsumer;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEProducer;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalDistribute;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalExcept;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalFilter;
@@ -49,6 +50,7 @@ import 
org.apache.doris.nereids.trees.plans.physical.PhysicalOneRowRelation;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalPlan;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalProject;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalRelation;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalSchemaScan;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalUnion;
 import org.apache.doris.nereids.trees.plans.physical.RuntimeFilter;
 import org.apache.doris.nereids.util.ExpressionUtils;
@@ -199,13 +201,17 @@ public class RuntimeFilterGenerator extends 
PlanPostProcessor {
                     continue;
                 }
                 Slot olapScanSlot = aliasTransferMap.get(targetSlot).second;
+                PhysicalRelation scan = aliasTransferMap.get(targetSlot).first;
+                Preconditions.checkState(scan != null, "scan is null");
+                if (!checkPhysicalRelationType(scan)) {
+                    continue;
+                }
                 RuntimeFilter filter = new RuntimeFilter(generator.getNextId(),
                         bitmapContains.child(0), 
ImmutableList.of(olapScanSlot),
                         ImmutableList.of(bitmapContains.child(1)), type, i, 
join, isNot, -1L);
                 ctx.addJoinToTargetMap(join, olapScanSlot.getExprId());
                 ctx.setTargetExprIdToFilter(olapScanSlot.getExprId(), filter);
-                
ctx.setTargetsOnScanNode(aliasTransferMap.get(targetSlot).first.getRelationId(),
-                        olapScanSlot);
+                ctx.setTargetsOnScanNode(scan.getRelationId(), olapScanSlot);
                 
join.addBitmapRuntimeFilterCondition(bitmapRuntimeFilterCondition);
             }
         }
@@ -306,7 +312,9 @@ public class RuntimeFilterGenerator extends 
PlanPostProcessor {
         PhysicalRelation scan = aliasTransferMap.get(unwrappedSlot).first;
 
         Preconditions.checkState(olapScanSlot != null && scan != null);
-
+        if (!checkPhysicalRelationType(scan)) {
+            return;
+        }
         if (scan instanceof PhysicalCTEConsumer) {
             Set<CTEId> processedCTE = 
context.getRuntimeFilterContext().getProcessedCTE();
             CTEId cteId = ((PhysicalCTEConsumer) scan).getCteId();
@@ -370,6 +378,10 @@ public class RuntimeFilterGenerator extends 
PlanPostProcessor {
                     continue;
                 }
                 PhysicalRelation scan = aliasTransferMap.get(origSlot).first;
+                Preconditions.checkState(scan != null, "scan is null");
+                if (!checkPhysicalRelationType(scan)) {
+                    continue;
+                }
                 if (type == TRuntimeFilterType.IN_OR_BLOOM
                         && ctx.getSessionVariable().getEnablePipelineEngine()
                         && hasRemoteTarget(join, scan)) {
@@ -646,6 +658,14 @@ public class RuntimeFilterGenerator extends 
PlanPostProcessor {
         }
     }
 
+    private boolean checkPhysicalRelationType(PhysicalRelation scan) {
+        if ((scan instanceof PhysicalCatalogRelation && !(scan instanceof 
PhysicalSchemaScan))
+                || scan instanceof PhysicalCTEConsumer) {
+            return true;
+        }
+        return false;
+    }
+
     private boolean checkCanPushDownIntoBasicTable(PhysicalPlan root) {
         // only support spj currently
         List<PhysicalPlan> plans = Lists.newArrayList();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to