@@ -88,19 +88,6 @@ public void execute(JobContext jobContext) {
88
88
}
89
89
return ;
90
90
}
91
- if (((RootPlanTreeRewriteJob ) rewriteJobs .get (0 )).getRules ().get (0 ).getRuleType ()
92
- == RuleType .INFER_SET_OPERATOR_DISTINCT ) {
93
- LOG .info ("@#@#@# INFER_SET_OPERATOR_DISTINCT apply \n "
94
- + applyCboRuleCtx .getRewritePlan ().treeString ()
95
- + "memo\n "
96
- + applyCboRuleCtx .getMemo ().toString ()
97
- );
98
- LOG .info ("@#@#@# INFER_SET_OPERATOR_DISTINCT skip \n "
99
- + skipCboRuleCtx .getRewritePlan ().treeString ()
100
- + "memo\n "
101
- + skipCboRuleCtx .getMemo ().toString ()
102
- );
103
- }
104
91
// If the candidate applied cbo rule is better, replace the original plan with it.
105
92
if (appliedCboRuleCost .get ().first .getValue () < skipCboRuleCost .get ().first .getValue ()) {
106
93
currentCtx .setRewritePlan (applyCboRuleCtx .getRewritePlan ());
@@ -182,7 +169,16 @@ private Optional<Pair<Cost, GroupExpression>> getCost(CascadesContext currentCtx
182
169
Rewriter .getWholeTreeRewriterWithoutCostBasedJobs (rootCtxCopy ).execute ();
183
170
// Do optimize
184
171
new Optimizer (rootCtxCopy ).execute ();
185
- return rootCtxCopy .getMemo ().getRoot ().getLowestCostPlan (
172
+ Optional < Pair < Cost , GroupExpression >> result = rootCtxCopy .getMemo ().getRoot ().getLowestCostPlan (
186
173
rootCtxCopy .getCurrentJobContext ().getRequiredProperties ());
174
+ if (((RootPlanTreeRewriteJob ) rewriteJobs .get (0 )).getRules ().get (0 ).getRuleType ()
175
+ == RuleType .INFER_SET_OPERATOR_DISTINCT ) {
176
+ LOG .info ("@#@#@# INFER_SET_OPERATOR_DISTINCT \n "
177
+ + cboCtx .getRewritePlan ().treeString ()
178
+ + "memo\n "
179
+ + rootCtxCopy .getMemo ().toString ()
180
+ );
181
+ }
182
+ return result ;
187
183
}
188
184
}
0 commit comments