mapleFU commented on code in PR #45350:
URL: https://github.com/apache/arrow/pull/45350#discussion_r1929540696


##########
cpp/src/parquet/arrow/reader.cc:
##########
@@ -1025,12 +1025,15 @@ Result<std::unique_ptr<RecordBatchReader>> 
FileReaderImpl::GetRecordBatchReader(
   ::arrow::Iterator<RecordBatchIterator> batches = 
::arrow::MakeFunctionIterator(
       [readers, batch_schema, num_rows,
        this]() mutable -> ::arrow::Result<RecordBatchIterator> {
-        ::arrow::ChunkedArrayVector columns(readers.size());
-
         // don't reserve more rows than necessary
         int64_t batch_size = std::min(properties().batch_size(), num_rows);
-        num_rows -= batch_size;
+        if (batch_size == 0) {
+          // We can return end immediately for 0 batch size
+          return ::arrow::IterationTraits<RecordBatchIterator>::End();
+        }

Review Comment:
   Agree. `Status LoadBatch(int64_t records_to_read) final` has called 
`AttachStatistics`, which forces statistics exists, and the metadata will also 
calles rowgroup to call `input_->column_chunk_metadata()`



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