45
45
* This job do
46
46
*/
47
47
public class CostBasedRewriteJob implements RewriteJob {
48
-
49
48
private static final Logger LOG = LogManager .getLogger (CostBasedRewriteJob .class );
50
49
51
50
private final List <RewriteJob > rewriteJobs ;
@@ -72,7 +71,6 @@ public void execute(JobContext jobContext) {
72
71
// this means rewrite do not do anything
73
72
return ;
74
73
}
75
-
76
74
// compare two candidates
77
75
Optional <Pair <Cost , GroupExpression >> skipCboRuleCost = getCost (currentCtx , skipCboRuleCtx , jobContext );
78
76
Optional <Pair <Cost , GroupExpression >> appliedCboRuleCost = getCost (currentCtx , applyCboRuleCtx , jobContext );
@@ -90,6 +88,19 @@ public void execute(JobContext jobContext) {
90
88
}
91
89
return ;
92
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
+ }
93
104
// If the candidate applied cbo rule is better, replace the original plan with it.
94
105
if (appliedCboRuleCost .get ().first .getValue () < skipCboRuleCost .get ().first .getValue ()) {
95
106
currentCtx .setRewritePlan (applyCboRuleCtx .getRewritePlan ());
0 commit comments