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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughProject.java:
##########
@@ -53,27 +60,56 @@ public List<Rule> buildRules() {
                         .whenNot(filter -> 
filter.child().child().getProjects().stream()
                                 .anyMatch(expr -> 
expr.anyMatch(WindowExpression.class::isInstance)))
                         .whenNot(filter -> 
filter.child().child().hasPushedDownToProjectionFunctions())
-                        .then(filter -> {
-                            LogicalLimit<LogicalProject<Plan>> limit = 
filter.child();
-                            LogicalProject<Plan> project = limit.child();
-
-                            return 
project.withProjectsAndChild(project.getProjects(),
-                                    new LogicalFilter<>(
-                                            
ExpressionUtils.replace(filter.getConjuncts(),
-                                                    
project.getAliasToProducer()),
-                                            
limit.withChildren(project.child())));
-                        
}).toRule(RuleType.PUSH_DOWN_FILTER_THROUGH_PROJECT_UNDER_LIMIT)
+                        
.then(PushDownFilterThroughProject::pushdownFilterThroughLimitProject)
+                        
.toRule(RuleType.PUSH_DOWN_FILTER_THROUGH_PROJECT_UNDER_LIMIT)
         );
     }
 
     /** pushdown Filter through project */
-    public static Plan 
pushdownFilterThroughProject(LogicalFilter<LogicalProject<Plan>> filter) {
+    private static Plan 
pushdownFilterThroughProject(LogicalFilter<LogicalProject<Plan>> filter) {
         LogicalProject<Plan> project = filter.child();
-        return project.withChildren(
+        Set<Slot> childOutputs = project.getOutputSet();
+        Pair<Set<Expression>, Set<Expression>> splitConjuncts =
+                splitConjunctsByChildOutput(filter.getConjuncts(), 
childOutputs);
+        if (splitConjuncts.second.isEmpty()) {

Review Comment:
   add some comment to explain why need this if statement



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