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


##########
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:
   I'm not familiar with this reader implementation but can we do this 
optimization?
   If we can do this, we can assume that row group/column chunk metadata are 
available in data load logic.



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