This is an automated email from the ASF dual-hosted git repository.
jakevin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 60af62b41e [enhancement](Nereids) remove deriveStats jobs for some
groupExpression (#24835)
60af62b41e is described below
commit 60af62b41e13c8f63adcacc22ae50a135fae3c38
Author: 谢健 <[email protected]>
AuthorDate: Mon Sep 25 17:14:16 2023 +0800
[enhancement](Nereids) remove deriveStats jobs for some groupExpression
(#24835)
Don't call DeriveStatJob for follow group expressions:
- the group expression that is generated by the joinCommute rule
- the group expression that is generated by the implementation rule without
creating a new group
---
.../doris/nereids/jobs/cascades/ApplyRuleJob.java | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java
index 0c366907a5..edf8a48afb 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java
@@ -30,6 +30,7 @@ import org.apache.doris.nereids.metrics.event.TransformEvent;
import org.apache.doris.nereids.minidump.NereidsTracer;
import org.apache.doris.nereids.pattern.GroupExpressionMatching;
import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@@ -82,11 +83,27 @@ public class ApplyRuleJob extends Job {
newGroupExpression.setFromRule(rule);
if (newPlan instanceof LogicalPlan) {
pushJob(new OptimizeGroupExpressionJob(newGroupExpression,
context));
+ if
(!rule.getRuleType().equals(RuleType.LOGICAL_JOIN_COMMUTE)) {
+ pushJob(new DeriveStatsJob(newGroupExpression,
context));
+ } else {
+ // The Join Commute rule preserves the operator's
expression and children,
+ // thereby not altering the statistics. Hence, there
is no need to derive statistics for it.
+ groupExpression.setStatDerived(true);
+ }
} else {
pushJob(new CostAndEnforcerJob(newGroupExpression,
context));
+ if (newGroupExpression.children().stream().anyMatch(g ->
g.getLogicalExpressions().isEmpty())) {
+ // If a rule creates a new group when generating a
physical plan,
+ // then we need to derive statistics for it, e.g.,
logicalTopToPhysicalTopN rule:
+ // logicalTopN ==> GlobalPhysicalTopN
+ // -> localPhysicalTopN
+ // These implementation rules integrate rules for plan
shape transformation.
+ pushJob(new DeriveStatsJob(newGroupExpression,
context));
+ } else {
+ groupExpression.setStatDerived(true);
+ }
}
- // we should derive stats for new logical/physical plan if the
plan missing the stats
- pushJob(new DeriveStatsJob(newGroupExpression, context));
+
NereidsTracer.logApplyRuleEvent(rule.toString(), plan,
newGroupExpression.getPlan());
APPLY_RULE_TRACER.log(TransformEvent.of(groupExpression, plan,
newPlans, rule.getRuleType()),
rule::isRewrite);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]