Skip to content

Commit ccdf5b6

Browse files
committed
add log costbase
1 parent e86b5fc commit ccdf5b6

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

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

+10-14
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,6 @@ public void execute(JobContext jobContext) {
8888
}
8989
return;
9090
}
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-
}
10491
// If the candidate applied cbo rule is better, replace the original plan with it.
10592
if (appliedCboRuleCost.get().first.getValue() < skipCboRuleCost.get().first.getValue()) {
10693
currentCtx.setRewritePlan(applyCboRuleCtx.getRewritePlan());
@@ -182,7 +169,16 @@ private Optional<Pair<Cost, GroupExpression>> getCost(CascadesContext currentCtx
182169
Rewriter.getWholeTreeRewriterWithoutCostBasedJobs(rootCtxCopy).execute();
183170
// Do optimize
184171
new Optimizer(rootCtxCopy).execute();
185-
return rootCtxCopy.getMemo().getRoot().getLowestCostPlan(
172+
Optional<Pair<Cost, GroupExpression>> result = rootCtxCopy.getMemo().getRoot().getLowestCostPlan(
186173
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;
187183
}
188184
}

0 commit comments

Comments
 (0)