englefly commented on code in PR #66898:
URL: https://github.com/apache/doris/pull/66898#discussion_r3809825925


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java:
##########
@@ -690,6 +690,13 @@ public class Rewriter extends AbstractBatchJobExecutor {
                         topDown(new PushDownAggThroughJoinOnPkFk()),
                         topDown(new PullUpJoinFromUnionAll())
                 ),
+                // RBO rules that depend on statistics (e.g. InitJoinOrder, 
SkewJoin, Eager
+                // aggregation, DecomposeRepeatWithPreAggregation, 
DistinctAggStrategySelector)
+                // must be placed AFTER OperativeColumnDerive: 
StatsCalculator.computeOlapScan
+                // only fetches column stats of operative slots, so rules 
running before the
+                // derivation would fetch stats of all table columns, 
polluting the column stats
+                // cache and wasting time on wide tables.
+                custom(RuleType.OPERATIVE_COLUMN_DERIVE, 
OperativeColumnDerive::new),

Review Comment:
   总共有3处,其他两处不能移除
   一处是 mv 内部使用, 
   一处是rewrite 结束时使用, 因为
   1. NormalizeOlapTableStreamScan 会重建节点, 需要重新推导
   2. column prune后, operative slots 会变少, 这样cbo阶段传播的colStats也更少



-- 
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]

Reply via email to