github-actions[bot] commented on code in PR #68282:
URL: https://github.com/apache/doris/pull/68282#discussion_r4072038606


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/analysis/TableStatsMeta.java:
##########
@@ -195,6 +255,15 @@ public void update(AnalysisInfo analyzedJob, TableIf 
tableIf) {
             if (tableIf instanceof OlapTable) {
                 OlapTable olapTable = (OlapTable) tableIf;
                 indexesRowCount.putAll(analyzedJob.indexesRowCount);
+                // The collected row count above already includes the rows 
which had been loaded when the
+                // job was built, remember how many they were, they are not 
delta rows. The baseline may
+                // only advance together with the collected base index row 
count, an analysis of another
+                // index (a materialized view) doesn't touch it.
+                // Statistics supplied by the user are not collected from the 
table, they carry no baseline.
+                if (!analyzedJob.userInject

Review Comment:
   A user-injected base-index count replaces `indexesRowCount`, but this branch 
deliberately leaves the older `updatedRowsBase` in place. A later column-scoped 
`DROP STATS` removes the column and clears `userInjected` in 
`invalidateLocalStats()` without clearing either value. In the post-truncate 
window, reset can leave `base=0`, a load of `N` rows sets `updatedRows=N`, 
`ALTER ... MODIFY COLUMN ... SET STATS ('row_count'='N')` stores `index=N`, and 
then `DROP STATS t(c)` makes the fallback return `N + (N - 0) = 2N` while BE 
counts are still unknown. Before this field, the empty column-meta map returned 
a zero delta. Please keep the injected index count and its baseline/provenance 
coupled (or invalidate the injected count when the flag is cleared), and cover 
this sequential lifecycle.



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