File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 3030import org .apache .doris .nereids .rules .Rule ;
3131import org .apache .doris .nereids .rules .RuleType ;
3232import org .apache .doris .nereids .trees .expressions .CTEId ;
33+ import org .apache .doris .nereids .trees .plans .Plan ;
3334import org .apache .doris .nereids .trees .plans .logical .LogicalCTEAnchor ;
3435import org .apache .doris .nereids .trees .plans .logical .LogicalPlan ;
3536import 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
You can’t perform that action at this time.
0 commit comments