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


##########
parquet/src/arrow/record_reader/mod.rs:
##########
@@ -184,11 +185,24 @@ where
     /// # Returns
     ///
     /// Number of records skipped
-    pub fn skip_records(&mut self, num_records: usize) -> Result<usize> {
+    pub fn skip_records(
+        &mut self,
+        num_records: usize,
+        pages: &mut dyn PageIterator,

Review Comment:
   I would prefer we handle this outside RecordReader in the same way we have a 
free function for read_records. Otherwise this ends up with a somewhat confused 
API



##########
parquet/src/arrow/arrow_reader.rs:
##########
@@ -298,9 +307,14 @@ 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));
+                        // if page row count less than batch_size we must set 
batch size to page row count.
+                        // add check avoid dead loop
+                        if remaining != 0 {

Review Comment:
   You could inline this into the match expression 



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