Kikyou1997 commented on code in PR #11209:
URL: https://github.com/apache/doris/pull/11209#discussion_r936219192


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -70,14 +72,23 @@ public StatsCalculator(GroupExpression groupExpression) {
      * Do estimate.
      */
     public void estimate() {
+
         StatsDeriveResult stats = groupExpression.getPlan().accept(this, null);
         groupExpression.getOwnerGroup().setStatistics(stats);
-        Plan plan = groupExpression.getPlan();
-        long limit = plan.getLimit();
-        if (limit != -1) {
-            stats.setRowCount(Math.min(limit, stats.getRowCount()));
-        }
         groupExpression.setStatDerived(true);
+
+    }
+
+    @Override
+    public StatsDeriveResult visitLogicalLimit(LogicalLimit<Plan> limit, Void 
context) {
+        StatsDeriveResult stats = groupExpression.getCopyOfChildStats(0);
+        return stats.updateRowCountByLimit(limit.getLimit() + 
limit.getOffset());
+    }
+
+    @Override
+    public StatsDeriveResult visitPhysicalLimit(PhysicalLimit<Plan> limit, 
Void context) {
+        StatsDeriveResult stats = groupExpression.getCopyOfChildStats(0);
+        return stats.updateRowCountByLimit(limit.getLimit() + 
limit.getOffset());

Review Comment:
   I think so



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