tustvold commented on code in PR #2158:
URL: https://github.com/apache/arrow-rs/pull/2158#discussion_r930042383


##########
parquet/src/arrow/arrow_reader.rs:
##########
@@ -298,11 +307,15 @@ impl Iterator for ParquetRecordBatchReader {
                     continue;
                 }
 
+                // try to read record
                 let to_read = match 
front.row_count.checked_sub(self.batch_size) {
-                    Some(remaining) => {
-                        selection.push_front(RowSelection::skip(remaining));
+                    Some(remaining) if remaining != 0 => {
+                        // if page row count less than batch_size we must set 
batch size to page row count.
+                        // add check avoid dead loop
+                        selection.push_front(RowSelection::select(remaining));
                         self.batch_size
                     }
+                    Some(_) => self.batch_size,

Review Comment:
   ```suggestion
                       _ => self.batch_size,
   ```
   
   And remove the `None` case below. If `remaining == 0` then `front.row_count 
== self.batch_size`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to