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

   # Which issue does this PR close?
   
   - Part of #10624.
   
   # Rationale for this change
   
   `RowSelection` exposes `row_count()` (selected rows) and 
`skipped_row_count()` (skipped rows), but no way to get the total number of 
rows a selection spans. Callers that need the total (e.g. to validate a 
selection against a row group's row count, as #10702 does) must call both 
methods, which iterates a selector-backed selection twice and performs two 
popcounts on a mask-backed selection just to have them cancel out.
   
   # What changes are included in this PR?
   
   Adds `RowSelection::total_row_count()`, which computes the total in a single 
pass:
   
   - selector-backed: one sum over the selectors
   - mask-backed: `mask.len()`, O(1) with no popcount
   
   # Are these changes tested?
   
   Yes, a unit test covers both backings plus the empty selection.
   
   # Are there any user-facing changes?
   
   New public method `RowSelection::total_row_count()`. No changes to existing 
APIs.
   


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