Skip to content

Commit ef065c6

Browse files
committed
fix
1 parent 131fe8b commit ef065c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.doris.nereids.rules.Rule;
3131
import org.apache.doris.nereids.rules.RuleType;
3232
import org.apache.doris.nereids.trees.expressions.CTEId;
33+
import org.apache.doris.nereids.trees.plans.Plan;
3334
import org.apache.doris.nereids.trees.plans.logical.LogicalCTEAnchor;
3435
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
3536
import org.apache.doris.qe.ConnectContext;
@@ -78,6 +79,7 @@ public void execute(JobContext jobContext) {
7879
CascadesContext applyCboRuleCtx = CascadesContext.newCurrentTreeContext(currentCtx);
7980
// execute cbo rule on one candidate
8081
Rewriter.getCteChildrenRewriter(applyCboRuleCtx, rewriteJobs).execute();
82+
Plan applyCboPlan = applyCboRuleCtx.getRewritePlan();
8183
if (skipCboRuleCtx.getRewritePlan().deepEquals(applyCboRuleCtx.getRewritePlan())) {
8284
// this means rewrite do not do anything
8385
return;
@@ -109,8 +111,7 @@ public void execute(JobContext jobContext) {
109111
}
110112
// If the candidate applied cbo rule is better, replace the original plan with it.
111113
if (appliedCboRuleCost.get().first.getValue() < skipCboRuleCost.get().first.getValue()) {
112-
currentCtx.addPlanProcesses(applyCboRuleCtx.getPlanProcesses());
113-
currentCtx.setRewritePlan(applyCboRuleCtx.getRewritePlan());
114+
currentCtx.setRewritePlan(applyCboPlan);
114115
}
115116
}
116117

0 commit comments

Comments
 (0)