morrySnow commented on code in PR #24432:
URL: https://github.com/apache/doris/pull/24432#discussion_r1326844560


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java:
##########
@@ -168,6 +144,34 @@ public PhysicalCTEProducer 
visitPhysicalCTEProducer(PhysicalCTEProducer producer
         return producer;
     }
 
+    @Override
+    public PhysicalPlan visitPhysicalTopN(PhysicalTopN<? extends Plan> topN, 
CascadesContext context) {
+        topN.child().accept(this, context);
+        PhysicalPlan child = (PhysicalPlan) topN.child();
+        for (Slot slot : child.getOutput()) {
+            
context.getRuntimeFilterContext().getAliasTransferMap().remove(slot);
+        }
+        return topN;
+    }
+
+    @Override
+    public PhysicalPlan visitPhysicalWindow(PhysicalWindow<? extends Plan> 
window, CascadesContext context) {
+        window.child().accept(this, context);
+        Set<Slot> notMapped = 
window.child().getOutputSet().stream().collect(Collectors.toSet());
+        for (NamedExpression expr : window.getWindowExpressions()) {
+            if (expr instanceof Alias && expr.child(0) instanceof 
WindowExpression) {
+                WindowExpression winExpr = (WindowExpression) expr.child(0);
+                for (Expression partitionKey : winExpr.getPartitionKeys()) {
+                    notMapped.remove(partitionKey);
+                }

Review Comment:
   should only push down common window expression's partition key filter. for 
example, we have two window function in one window node. the first partition by 
c1, c2 and c3. the second partition by c1 and c2. then we only could push down 
the filter on c1 and c2. filter on c3 should not be pushed.



-- 
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

Reply via email to