Kikyou1997 commented on code in PR #19934:
URL: https://github.com/apache/doris/pull/19934#discussion_r1206163250
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriter.java:
##########
@@ -85,51 +92,58 @@
*/
public class NereidsRewriter extends BatchRewriteJob {
private static final List<RewriteJob> REWRITE_JOBS = jobs(
+
+ bottomUp(new InlineCTE()),
+
topic("Plan Normalization",
- topDown(
- new EliminateOrderByConstant(),
- new EliminateGroupByConstant(),
- // MergeProjects depends on this rule
- new LogicalSubQueryAliasToLogicalProject(),
- // TODO: we should do expression normalization after plan
normalization
- // because some rewritten depends on sub expression tree
matching
- // such as group by key matching and replaced
- // but we need to do some normalization before subquery
unnesting,
- // such as extract common expression.
- new ExpressionNormalization(),
- new ExpressionOptimization(),
- new AvgDistinctToSumDivCount(),
- new CountDistinctRewrite(),
- new ExtractFilterFromCrossJoin()
- ),
- topDown(
- // ExtractSingleTableExpressionFromDisjunction conflict to
InPredicateToEqualToRule
- // in the ExpressionNormalization, so must invoke in
another job, or else run into
- // dead loop
- new ExtractSingleTableExpressionFromDisjunction()
- )
+ topDown(
+ new EliminateOrderByConstant(),
+ new EliminateGroupByConstant(),
+ // MergeProjects depends on this rule
+ new LogicalSubQueryAliasToLogicalProject(),
+ // TODO: we should do expression normalization
after plan normalization
+ // because some rewritten depends on sub
expression tree matching
+ // such as group by key matching and replaced
+ // but we need to do some normalization before
subquery unnesting,
+ // such as extract common expression.
+ new ExpressionNormalization(),
+ new ExpressionOptimization(),
+ new AvgDistinctToSumDivCount(),
+ new CountDistinctRewrite(),
+ new ExtractFilterFromCrossJoin()
+ ),
+ topDown(
+ // ExtractSingleTableExpressionFromDisjunction
conflict to InPredicateToEqualToRule
+ // in the ExpressionNormalization, so must invoke
in another job, or else run into
+ // dead loop
+ new ExtractSingleTableExpressionFromDisjunction()
+ )
),
+ topic("Rewrite CTE", topDown(
+ new PushdownFilterThroughCTEAnchor(),
+ new PushdownProjectThroughCTEAnchor())),
+
Review Comment:
Because rewrtie for producer is recursively....
--
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]