jiangxt2 commented on code in PR #54926:
URL: https://github.com/apache/arrow/pull/54926#discussion_r4442970063
##########
python/pyarrow/_orc.pyx:
##########
@@ -364,6 +366,54 @@ cdef class ORCReader(_Weakrefable):
return pyarrow_wrap_batch(sp_record_batch)
+ def iter_batches(self, int64_t batch_size, stripes=None, columns=None):
+ cdef:
+ shared_ptr[CRecordBatchReader] batch_reader
+ shared_ptr[CRecordBatch] batch
+ std_vector[c_string] names
+ optional[std_vector[c_string]] selected_names
+ int64_t stripe
+
+ if batch_size <= 0:
+ raise ValueError("batch_size must be greater than zero")
Review Comment:
Removed the duplicate check from Cython. The public Python method still
rejects nonpositive batch sizes.
##########
python/pyarrow/_orc.pyx:
##########
@@ -364,6 +366,54 @@ cdef class ORCReader(_Weakrefable):
return pyarrow_wrap_batch(sp_record_batch)
+ def iter_batches(self, int64_t batch_size, stripes=None, columns=None):
+ cdef:
+ shared_ptr[CRecordBatchReader] batch_reader
+ shared_ptr[CRecordBatch] batch
+ std_vector[c_string] names
+ optional[std_vector[c_string]] selected_names
+ int64_t stripe
+
+ if batch_size <= 0:
+ raise ValueError("batch_size must be greater than zero")
+ if columns is not None:
+ names = [tobytes(name) for name in columns]
+ selected_names = optional[std_vector[c_string]](names)
+
+ # Keep self (and its source) alive for the generator's entire lifetime.
Review Comment:
Reworded the comment to explain the internal `None` sentinel for whole-file
reading, and why zero-column projection uses individual stripe readers to
preserve row counts.
--
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]