You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/05 07:00:36 UTC

[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #2694: combine limit and offset

Ted-Jiang commented on code in PR #2694:
URL: https://github.com/apache/arrow-datafusion/pull/2694#discussion_r889657737


##########
datafusion/core/src/physical_plan/limit.rs:
##########
@@ -176,17 +184,18 @@ impl ExecutionPlan for GlobalLimitExec {
 
     fn statistics(&self) -> Statistics {
         let input_stats = self.input.statistics();
+        let skip = self.skip.unwrap_or(0);
         match input_stats {
             // if the input does not reach the limit globally, return input stats
             Statistics {
                 num_rows: Some(nr), ..
-            } if nr <= self.limit => input_stats,
+            } if nr - skip <= self.fetch.unwrap_or(usize::MAX) => input_stats,

Review Comment:
   nit: like
   ```
   if the input is greater than the limit, the num_row will be the limit
   ```
   and 
   ```
   // if the input is greater than the limit, the num_row will be greater
   // than the limit because the partitions will be limited separatly
   // the statistic
   ```
   limit should change to fetch



-- 
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: github-unsubscribe@arrow.apache.org

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