englefly commented on code in PR #59517:
URL: https://github.com/apache/doris/pull/59517#discussion_r2663925583
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java:
##########
@@ -69,14 +79,21 @@ public void execute(JobContext jobContext) {
CascadesContext applyCboRuleCtx =
CascadesContext.newCurrentTreeContext(currentCtx);
// execute cbo rule on one candidate
Rewriter.getCteChildrenRewriter(applyCboRuleCtx,
rewriteJobs).execute();
+ Plan applyCboPlan = applyCboRuleCtx.getRewritePlan();
if
(skipCboRuleCtx.getRewritePlan().deepEquals(applyCboRuleCtx.getRewritePlan())) {
// this means rewrite do not do anything
return;
}
+ Map<CTEId, LogicalPlan> currentCteProducers = Maps.newHashMap();
+ // cost based rewrite job may contaminate
StatementContext.rewrittenCteProducer
+ // clone current rewrittenCteProducer, and restore it after getCost(.).
+
currentCtx.getStatementContext().getRewrittenCteProducer().forEach(currentCteProducers::put);
Review Comment:
增加了CteEnvironmentSnapshot, 恢复所有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: [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]