Skip to content

GH-3596: Add RowRanges.Builder for incremental construction from selected row indices#3597

Open
peter-toth wants to merge 1 commit into
apache:masterfrom
peter-toth:GH-3596-row-ranges-builder
Open

GH-3596: Add RowRanges.Builder for incremental construction from selected row indices#3597
peter-toth wants to merge 1 commit into
apache:masterfrom
peter-toth:GH-3596-row-ranges-builder

Conversation

@peter-toth
Copy link
Copy Markdown

Rationale for this change

This PR is based on @mbutrovich's previous work.

Opening up APIs needed by a later materialization feature in Spark. External readers need to assemble a RowRanges incrementally from a stream of selected row indices (e.g. produced by a downstream filter or join) without having to know page boundaries ahead of time.

What changes are included in this PR?

Adds a Builder to RowRanges that takes a strictly-increasing sequence of selected row indices via addSelected(long) and coalesces consecutive indices into Range entries. Out-of-order or duplicate calls throw IllegalArgumentException.

Are these changes tested?

Yes. TestRowRanges covers single/multiple/coalesced ranges, the empty builder case, and the out-of-order/duplicate rejection paths.

Are there any user-facing changes?

No.

Closes #3596

…m selected row indices

### Rationale for this change

Opening up APIs needed by a later materialization feature in Spark. External readers need to assemble a RowRanges incrementally from a stream of selected row indices (e.g. produced by a downstream filter or join) without having to know page boundaries ahead of time.

### What changes are included in this PR?

Adds a Builder to RowRanges that takes a strictly-increasing sequence of selected row indices via addSelected(long) and coalesces consecutive indices into Range entries. Out-of-order or duplicate calls throw IllegalArgumentException.

### Are these changes tested?

Yes. TestRowRanges covers single/multiple/coalesced ranges, the empty builder case, and the out-of-order/duplicate rejection paths.

### Are there any user-facing changes?

No.

Closes apache#3596

Co-authored-by: Matt Butrovich <mbutrovich@gmail.com>
@peter-toth peter-toth force-pushed the GH-3596-row-ranges-builder branch from e11f3d9 to 58857df Compare June 5, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a RowRanges.Builder for incremental construction from selected row indices

1 participant