Skip to content

Commit e86b5fc

Browse files
committed
print cost base INFER_SET_OPERATOR_DISTINCT memo
1 parent 32c6c6a commit e86b5fc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

+13-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
* This job do
4646
*/
4747
public class CostBasedRewriteJob implements RewriteJob {
48-
4948
private static final Logger LOG = LogManager.getLogger(CostBasedRewriteJob.class);
5049

5150
private final List<RewriteJob> rewriteJobs;
@@ -72,7 +71,6 @@ public void execute(JobContext jobContext) {
7271
// this means rewrite do not do anything
7372
return;
7473
}
75-
7674
// compare two candidates
7775
Optional<Pair<Cost, GroupExpression>> skipCboRuleCost = getCost(currentCtx, skipCboRuleCtx, jobContext);
7876
Optional<Pair<Cost, GroupExpression>> appliedCboRuleCost = getCost(currentCtx, applyCboRuleCtx, jobContext);
@@ -90,6 +88,19 @@ public void execute(JobContext jobContext) {
9088
}
9189
return;
9290
}
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+
}
93104
// If the candidate applied cbo rule is better, replace the original plan with it.
94105
if (appliedCboRuleCost.get().first.getValue() < skipCboRuleCost.get().first.getValue()) {
95106
currentCtx.setRewritePlan(applyCboRuleCtx.getRewritePlan());

0 commit comments

Comments
 (0)