Skip to content

feat: Add RowSelection::total_row_count - #10704

Open
haohuaijin wants to merge 1 commit into
apache:mainfrom
haohuaijin:row-selection-total-row-count
Open

feat: Add RowSelection::total_row_count#10704
haohuaijin wants to merge 1 commit into
apache:mainfrom
haohuaijin:row-selection-total-row-count

Conversation

@haohuaijin

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

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.

@github-actions github-actions Bot added the parquet Changes to the parquet crate label Aug 16, 2026
@haohuaijin haohuaijin changed the title parquet: Add RowSelection::total_row_count feat: Add RowSelection::total_row_count Aug 16, 2026

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants