Reminiscent commented on code in PR #18784:
URL: https://github.com/apache/doris/pull/18784#discussion_r1194755873


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -464,6 +478,32 @@ private Statistics computeTopN(TopN topN) {
         return stats.withRowCount(Math.min(stats.getRowCount(), 
topN.getLimit()));
     }
 
+    private Statistics computePartitionTopN(PartitionTopN partitionTopN) {
+        Statistics stats = groupExpression.childStatistics(0);
+        double rowCount = stats.getRowCount();
+        List<Expression> partitionKeys = partitionTopN.getPartitionKeys();
+        if (!partitionTopN.hasGlobalLimit() && !partitionKeys.isEmpty()) {

Review Comment:
   For the limit part, I don't think it will cause some bad cases.
   ```
   private Statistics computeLimit(Limit limit) {
           Statistics stats = groupExpression.childStatistics(0);
           return stats.withRowCount(Math.min(stats.getRowCount(), 
limit.getLimit()));
       }
   ```
   Because we only get the minimal value.



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