You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/06/06 12:42:29 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #20508: [fix](nereids)filter and project node should be pushed down through cte

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownFilterThroughCTEAnchor.java:
##########
@@ -31,10 +31,10 @@ public class PushdownFilterThroughCTEAnchor extends OneRewriteRuleFactory {
 
     @Override
     public Rule build() {
-        return logicalFilter(logicalCTEAnchor()).thenApply(ctx -> {
-            LogicalFilter<LogicalCTEAnchor<Plan, Plan>> filter = ctx.root;
-            LogicalCTEAnchor<Plan, Plan> anchor = filter.child();
-            return anchor.withChildren(anchor.left(), filter.withChildren((Plan) anchor.right()));
+        return logicalFilter(logicalCTE()).thenApply(ctx -> {
+            LogicalFilter<LogicalCTE<Plan>> filter = ctx.root;
+            LogicalCTE<Plan> anchor = filter.child();
+            return anchor.withChildren(filter.withChildren(anchor.child()));
         }).toRule(RuleType.PUSHDOWN_FILTER_THROUGH_CTE_ANCHOR);

Review Comment:
   ```suggestion
           }).toRule(RuleType.PUSHDOWN_FILTER_THROUGH_CTE);
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleSet.java:
##########
@@ -129,7 +130,8 @@ public class RuleSet {
             new MergeFilters(),
             new MergeGenerates(),
             new MergeLimits(),
-            new PushdownFilterThroughCTEAnchor());
+            new PushdownFilterThroughCTEAnchor(),
+            new PushdownProjectThroughCTEAnchor());

Review Comment:
   ```suggestion
               new PushdownFilterThroughCTE(),
               new PushdownProjectThroughCTE());
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownProjectThroughCTEAnchor.java:
##########
@@ -31,10 +31,10 @@ public class PushdownProjectThroughCTEAnchor extends OneRewriteRuleFactory {
 
     @Override
     public Rule build() {
-        return logicalProject(logicalCTEAnchor()).thenApply(ctx -> {
-            LogicalProject<LogicalCTEAnchor<Plan, Plan>> project = ctx.root;
-            LogicalCTEAnchor<Plan, Plan> anchor = project.child();
-            return anchor.withChildren(anchor.child(0), project.withChildren(anchor.child(1)));
+        return logicalProject(logicalCTE()).thenApply(ctx -> {
+            LogicalProject<LogicalCTE<Plan>> project = ctx.root;
+            LogicalCTE<Plan> anchor = project.child();
+            return anchor.withChildren(project.withChildren(anchor.child()));
         }).toRule(RuleType.PUSH_DOWN_PROJECT_THROUGH_CTE_ANCHOR);

Review Comment:
   ```suggestion
           }).toRule(RuleType.PUSH_DOWN_PROJECT_THROUGH_CTE);
   ```



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org