github-actions[bot] commented on code in PR #70102:
URL: https://github.com/apache/doris/pull/70102#discussion_r4476467015
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -1217,6 +1217,17 @@ private ColumnStatistic getColumnStatistic(TableIf
table, String colName, long i
}
ColumnStatistic columnStatistics =
Env.getCurrentEnv().getStatisticsCache().getColumnStatistics(
catalogId, dbId, table.getId(), idxId, colName,
connectContext);
+ return normalizeColumnStatistic(columnStatistics);
+ }
Review Comment:
[P2] Normalize merged partition statistics before estimation. When partition
analysis is enabled, `computeOlapScan` uses the non-null result of
`getPartitionColumnStatistic` directly; that helper returns
`PartitionColumnStatisticBuilder.toColumnStatistics()` without the new
`normalizeColumnStatistic`. A partition row with `ndv=0`, non-null min/max, and
`numNulls=count` therefore remains a known statistic and reaches the
scan/filter/join estimators, while the same table-level tuple is converted to
UNKNOWN. Please normalize the merged partition result and add a fixture with
this anomalous partition tuple; the current test only covers the UNKNOWN
fallback.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -1217,6 +1217,17 @@ private ColumnStatistic getColumnStatistic(TableIf
table, String colName, long i
}
Review Comment:
[P2] Preserve the cached population count for external row-count fallback.
`computeCatalogRelation` uses `getColumnStatsFromTableCache(...).count` when
`getRowCount()` is unknown; this new wrapper converts an accepted `ndv=0`,
non-null MIN/MAX, `numNulls=count` statistic into `ColumnStatistic.UNKNOWN`,
whose count is 1. A non-Olap table with an unknown metadata row count and
cached stats for millions of rows is therefore estimated as one row, skewing
every downstream join/scan decision. Keep the raw count for row-count recovery
while using UNKNOWN for column estimation.
--
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]