github-actions[bot] commented on code in PR #68282:
URL: https://github.com/apache/doris/pull/68282#discussion_r4089657633
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/analysis/TableStatsMeta.java:
##########
@@ -268,6 +374,24 @@ public long getBaseIndexDeltaRowCount(OlapTable table) {
return updatedRows.get() - maxUpdateRows;
}
+ /**
+ * The row count of the index together with the rows loaded since it was
collected, i.e. the row count of
+ * the table. Both are read by the planner without the table lock, for
instance while it plans a direct
+ * scan of a materialized view, so they have to come from the same state
of this record: a collected row
+ * count paired with the baseline of another analysis, or of a truncation,
would count rows twice or miss
+ * them. The rows loaded while this call runs are not part of the
snapshot, whichever state reads them
+ * accumulates them in {@link #updatedRows} and reports them as delta rows.
+ */
+ public synchronized long getRowCountWithDeltaRows(OlapTable table, long
indexId) {
+ long rowCount = getRowCount(indexId);
+ if (indexId != table.getBaseIndexId()) {
Review Comment:
[P2] Preserve the fallback for row-preserving DUP_KEYS rollups
This blanket non-base branch fixes the aggregating-rollup case from the
earlier thread, but it also covers ordinary unfiltered `DUP_KEYS` projection
rollups. Those inherit `DUP_KEYS` and use `AggregateType.NONE`, so they retain
one row per base row. After `TRUNCATE`, `buildEmptyIndexRowCount()` contains
only `baseIndexId -> 0`; loading N rows adds N only to `updatedRows`, while the
new rollup tablets still report `-1`. For a plan such as `OlapScan(t,
selectedIndex=r_dup[DUP_KEYS/NONE])`, this method therefore returns `-1` and
`computeOlapScan()` clamps N rows to cardinality 1; the parallel non-base guard
in `computeDeltaRowCount()` also hides them from filter estimation. This is the
complementary case to the existing aggregating-rollup thread, not a duplicate.
Please carry per-index baselines/deltas, or establish a zero baseline and use
the coherent fallback in both consumers when an index is proven row-preserving,
and add a post-truncate projection-rollup regression.
--
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]