wgtmac commented on code in PR #45350:
URL: https://github.com/apache/arrow/pull/45350#discussion_r1929528352
##########
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:
Yes, this fixes the issue from calling `FileReader::GetRecordBatchReader`.
However, is it cleaner to fix it in the `LeafReader::LoadBatch`? There might be
use cases that directly use the `ColumnReader` interface by calling
`FileReader::GetColumn` instead of `FileReader::GetRecordBatchReader`.
--
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]