englefly commented on code in PR #70480:
URL: https://github.com/apache/doris/pull/70480#discussion_r4680447680


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java:
##########
@@ -225,6 +251,18 @@ public PhysicalFilter visitPhysicalFilter(PhysicalFilter<? 
extends Plan> filter,
         return filter;
     }
 
+    @Override
+    public PhysicalOlapScan visitPhysicalOlapScan(PhysicalOlapScan scan, 
CascadesContext context) {
+        if (scan.getTable() instanceof OlapChangelogTableWrapper) {
+            // Base-table statistics do not describe the stream's incremental 
data.
+            context.getRuntimeFilterContext().addEffectiveSrcNode(scan,

Review Comment:
   Fixed in `b2273e4c08d`. The storage aggregate now inherits `CHANGELOG` from 
the scan in `getRelation()`. The FE test asserts that scalar `COUNT(*)` selects 
`PhysicalStorageLayerAggregate` and that the parent hash join retains its 
filter.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java:
##########
@@ -79,27 +86,35 @@ public Plan visit(Plan plan, CascadesContext context) {
     }
 
     @Override
-    public PhysicalRecursiveUnion visitPhysicalRecursiveUnion(
+    public PhysicalRecursiveUnion<? extends Plan, ? extends Plan> 
visitPhysicalRecursiveUnion(
             PhysicalRecursiveUnion<? extends Plan, ? extends Plan> 
recursiveUnion, CascadesContext context) {
-        for (Plan child : recursiveUnion.children()) {
-            child.accept(this, context);
-        }
+        visitChildrenAndPropagateChangelog(recursiveUnion, context);

Review Comment:
   Fixed in `9e677dc5e77`. The recursive anchor registers the seed's 
`CHANGELOG` source by CTE ID before the recursive term is visited. A matching 
`PhysicalWorkTableReference` inherits that source. The test checks the hash 
join inside the recursive term with unknown and non-selective statistics.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java:
##########
@@ -219,14 +219,15 @@ public void setTargetNullCount() {
     }
 
     /**
-     * the selectivity produced by predicate or rf
+     * Effective source types in increasing priority for propagation.
      */
     public enum EffectiveSrcType {
-        NATIVE, REF
+        REF, NATIVE, CHANGELOG
     }
 
     public void addEffectiveSrcNode(Plan node, EffectiveSrcType type) {
-        effectiveSrcNodes.put(node, type);
+        effectiveSrcNodes.merge(node, type,

Review Comment:
   Fixed in `b2b300dc8fa`. Effective-source maps now use plan-node identity. 
The test uses equal LIMITs on independent branches in both branch orders and 
checks that the ordinary build UNION stays unmarked and its filter is pruned.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to