englefly commented on code in PR #24835:
URL: https://github.com/apache/doris/pull/24835#discussion_r1335510095
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java:
##########
@@ -82,11 +83,24 @@ public void execute() throws AnalysisException {
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 {
+ // Join Commute rule doesn't change operator's
expression and children
+ // Therefore, the stats can't be changed. Don't derive
stats for it
+ groupExpression.setStatDerived(true);
+ }
} else {
pushJob(new CostAndEnforcerJob(newGroupExpression,
context));
+ if (newGroupExpression.children().stream().anyMatch(g ->
g.getLogicalExpressions().isEmpty())) {
+ // Only the implementation rule creates a new group.
The groupExpression should be derived
Review Comment:
“Only the implementation rule creates a new group” this comments is not
always right, please update it
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java:
##########
@@ -82,11 +83,24 @@ public void execute() throws AnalysisException {
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 {
+ // Join Commute rule doesn't change operator's
expression and children
+ // Therefore, the stats can't be changed. Don't derive
stats for it
+ groupExpression.setStatDerived(true);
+ }
} else {
pushJob(new CostAndEnforcerJob(newGroupExpression,
context));
+ if (newGroupExpression.children().stream().anyMatch(g ->
g.getLogicalExpressions().isEmpty())) {
+ // Only the implementation rule creates a new group.
The groupExpression should be derived
Review Comment:
“Only the implementation rule creates a new group” this comments is not
always right, please update it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]