huaxingao commented on code in PR #10943:
URL: https://github.com/apache/iceberg/pull/10943#discussion_r1719977369


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetReader.java:
##########
@@ -117,7 +122,12 @@ private static class FileIterator<T> implements 
CloseableIterator<T> {
 
     @Override
     public boolean hasNext() {
-      return valuesRead < totalValues;
+      long numToRead = totalValues;
+      if (pushedLimit > 0 && pushedLimit < numToRead) {

Review Comment:
   Technically, `pushedLimit` should never be 0 because Spark converts a limit 
of 0 to an empty table scan. I have changed the initial value of `pushedLimit` 
to -1 to ensure that it is never 0.
   
   I have modified the code accordingly. Is this better?
   ```
       public boolean hasNext() {
         long numToRead =
             (pushedLimit == -1 || pushedLimit >= totalValues) ? totalValues : 
pushedLimit;
         return valuesRead < numToRead;
       }
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to