morrySnow commented on code in PR #35875:
URL: https://github.com/apache/doris/pull/35875#discussion_r1636183048


##########
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:
   delay merge after check all partition could get beter perf



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to