ranflarion opened a new pull request, #12523:
URL: https://github.com/apache/arrow-rs/pull/12523

   # Which issue does this PR close?
   
   - Closes #12522.
   
   # Rationale for this change
   
   The push decoder reads one row group at a time but built each row group's 
readers for the configured batch size, and since #9093 every column reserves a 
whole batch up front. A row group with fewer rows than the batch size came back 
in buffers allocated for `batch_size` rows. `with_batch_size` already caps the 
batch size at the file's row count; this applies the same cap to each row group.
   
   # What changes are included in this PR?
   
   - `RowGroupReaderBuilder::next_row_group` caps the read plan's batch size at 
the row group's row count. The row group's array readers, predicate cache and 
data requests take the batch size from the plan, so they stay consistent with 
each other.
   - `CachedArrayReader` takes the row group's row count and stops there. With 
the cap, a row group always ends on a cache batch boundary. A consumer that 
served the column from the cache would otherwise skip its unused inner reader 
through the whole row group, decoding its dictionary page, only to find there 
is no further batch. This already happened for a row group whose row count is a 
multiple of the batch size.
   - `ScanPlanBuilder` is unchanged. Expanding a selection to cache batch 
boundaries gives the same ranges for either batch size when the row group has 
fewer rows than the batch size.
   
   # Are these changes tested?
   
   Yes. Two push decoder tests read a 200-row row group at a batch size of 400, 
with and without a row filter on the projected column, and check that the 
values buffer holds 200 rows. It held 400 before. A `CachedArrayReader` test 
checks that a consumer that drained a cached column does not advance its inner 
reader when asked for more rows.
   
   # Are there any significant user-facing changes?
   
   No. Batches hold the same rows, only the capacity of their buffers changes, 
and there are no public API changes.
   
   # AI usage disclosure
   
   AI tools were used to write the code, tests and this description. I own this 
change.
   


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