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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java:
##########
@@ -466,6 +466,8 @@ public class Rewriter extends AbstractBatchJobExecutor {
                     ),
                     // query rewrite support window, so add this rule here
                     custom(RuleType.AGG_SCALAR_SUBQUERY_TO_WINDOW_FUNCTION, 
AggScalarSubQueryToWindowFunction::new),
+                    custom(RuleType.PULL_UP_CTE_ANCHOR, PullUpCteAnchor::new),
+                    custom(RuleType.CTE_INLINE, CTEInline::new),

Review Comment:
   why add these two rules here?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java:
##########
@@ -223,8 +223,12 @@ private static CascadesContext 
newContext(Optional<CascadesContext> parent, Opti
             StatementContext statementContext, Plan initPlan, CTEContext 
cteContext,
             PhysicalProperties requireProperties, boolean 
isLeadingDisableJoinReorder,
             CTEContext recursiveCteContext) {
-        return new CascadesContext(parent, subtree, statementContext, 
initPlan, null,
+        CascadesContext cascadesContext = new CascadesContext(parent, subtree, 
statementContext, initPlan, null,
                 cteContext, requireProperties, isLeadingDisableJoinReorder, 
recursiveCteContext);
+        if (parent.isPresent() && parent.get().getOuterScope().isPresent()) {
+            cascadesContext.setOuterScope(parent.get().getOuterScope().get());
+        }
+        return cascadesContext;

Review Comment:
   should in ctor



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