englefly commented on code in PR #35875:
URL: https://github.com/apache/doris/pull/35875#discussion_r1636030225
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -745,8 +747,32 @@ private ColumnStatistic getColumnStatistic(TableIf table,
String colName, long i
return ColumnStatistic.UNKNOWN;
}
} else {
+ if (!partitionNames.isEmpty()) {
+ PartitionColumnStatisticBuilder builder = new
PartitionColumnStatisticBuilder();
+ boolean isFirst = true;
+ boolean hasUnknown = false;
+ for (String partitionName : partitionNames) {
+ PartitionColumnStatistic pcolStats =
Env.getCurrentEnv().getStatisticsCache()
+ .getPartitionColumnStatistics(
+ catalogId, dbId, table.getId(), idxId,
partitionName, colName);
+ if (pcolStats.isUnKnown) {
+ hasUnknown = true;
+ break;
+ }
+ if (isFirst) {
+ builder = new
PartitionColumnStatisticBuilder(pcolStats);
+ isFirst = false;
+ } else {
+ builder.merge(pcolStats);
Review Comment:
if any pcol stats is unknown, the merge process is broken. this check is
done in line758
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -764,19 +790,22 @@ private Statistics computeCatalogRelation(CatalogRelation
catalogRelation) {
Set<SlotReference> slotSet = slotSetBuilder.build();
Map<Expression, ColumnStatisticBuilder> columnStatisticBuilderMap =
new HashMap<>();
TableIf table = catalogRelation.getTable();
- boolean isOlapTable = table instanceof OlapTable;
AnalysisManager analysisManager =
Env.getCurrentEnv().getAnalysisManager();
TableStatsMeta tableMeta =
analysisManager.findTableStatsStatus(table.getId());
long tableUpdatedRows = tableMeta == null ? 0 :
tableMeta.updatedRows.get();
- double rowCount = catalogRelation.getTable().getRowCountForNereids();
boolean hasUnknownKeyCol = false;
long idxId = -1;
+ List<String> selectedPartitionNames = new ArrayList<>();
Review Comment:
done
--
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]