github-actions[bot] commented on code in PR #69028:
URL: https://github.com/apache/doris/pull/69028#discussion_r4310028634
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -384,11 +384,19 @@ public Statistics visitLogicalFilter(LogicalFilter<?
extends Plan> filter, Void
* returns the sum of deltaRowCount for all selected partitions or for the
table.
*/
private long computeDeltaRowCount(OlapScan olapScan) {
+ OlapTable olapTable = olapScan.getTable();
+ // The delta rows are the rows loaded into the base index which the
collected base index row count
+ // doesn't include yet. They are not the rows of an index which
aggregates them: such an index has its
+ // own (usually much smaller) row count, so the delta only applies to
a scan of an index which keeps
+ // one row per base row.
+ if (!TableStatsMeta.keepsOneRowPerBaseRow(olapTable,
olapScan.getSelectedIndexId())) {
+ return 0;
Review Comment:
[P2] Preserve stale-range recovery for non-row-preserving indexes
`computeDeltaRowCount()` also supplies `Statistics.deltaRowCount`, which
`FilterEstimation.estimate()` uses to retry zero estimates with unknown column
statistics. For an AGG table with rollup `r1(k1,v)`, load key 1, run FULL
ANALYZE, then load 100 distinct keys 100..199 without reanalyzing. The plan
`Filter(k1 >= 100) -> OlapScan(t INDEX r1)` still reads cached max=1. This
check sets delta=0, so the filter stays at zero although 100 rows match;
previously delta=100 triggered the retry and a nonzero estimate. This occurs
even after BE reports the index row count and distorts join/distribution
costing. Keep stale-statistics recovery available for these indexes
independently of whether base-row deltas may be added to their row counts, and
cover the analyze/load/out-of-range-filter case.
--
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]