Skip to content

[WIP][POC] GH-51268: [C++][Parquet] Unpack equal-width DELTA_BINARY_PACKED miniblocks in one call - #51250

Draft
prtkgaur wants to merge 2 commits into
apache:mainfrom
prtkgaur:delta-binary-packed-coalesce-miniblocks
Draft

prtkgaur wants to merge 2 commits into
apache:mainfrom
prtkgaur:delta-binary-packed-coalesce-miniblocks

Conversation

@prtkgaur

@prtkgaur prtkgaur commented Sep 9, 2026 •

Copy link
Copy Markdown

Rationale for this change

Two thins that impact DELTA_BINARY_PACKED decoder per value:

  1. Pointer aliasing in the prefix-sum loop. min_delta_ and last_value_ have the same
    type as the output buffer, so the compiler cannot prove the store does not alias them
    and reloads both for every value.
  2. Per-call setup in the unpacker. Miniblocks are unpacked one at a time, which at the
    default geometry means a call per 32 values for 32-bit and per 64 for 64-bit. At narrow
    widths, where unpacking a value is cheap, that setup is a large share of the work.

What changes are included in this PR?

The prefix-sum loop now keeps the running value and the frame of reference in locals and
writes the running value back once, after the loop.

The decoder also unpacks consecutive miniblocks of equal bit width in one call.

Are these changes tested?

A new typed test covers the width patterns that decide where a run starts and stops, and
a read batch size that stops partway through a coalesced run.

Benchmark

Graviton4, GCC 11.5, Release, one core, 9 repetitions, medians, 65,536 values. Both
sides were built twice, with the builds interleaved; the two builds agree within 0.6%.

benchmark main this PR
Decode_Int32_Narrow 99.8 us 74.8 us 1.34x
Decode_Int32_Wide 101.9 us 83.7 us 1.22x
Decode_Int64_Narrow 82.1 us 70.9 us 1.17x
Decode_Int64_Wide 322.3 us 318.6 us 1.01x
Decode_Int32_Fixed 19.8 us 20.4 us 0.97x
Decode_Int64_Fixed 30.6 us 31.3 us 0.98x

Are there any user-facing changes?

No. No API change, no format change, and decoded values are identical.

@prtkgaur prtkgaur changed the title Delta binary packed coalesce miniblocks [WIP][POC] Delta binary packed coalesce miniblocks Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions github-actions Bot added the awaiting review Awaiting review label Sep 9, 2026
@prtkgaur
prtkgaur force-pushed the delta-binary-packed-coalesce-miniblocks branch from c16db5a to fa243dd Compare September 9, 2026 03:07
@prtkgaur prtkgaur changed the title [WIP][POC] Delta binary packed coalesce miniblocks GH-51268: [C++][Parquet] Unpack equal-width DELTA_BINARY_PACKED miniblocks in one call Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #51268 has been automatically assigned in GitHub to PR creator.

@prtkgaur
prtkgaur force-pushed the delta-binary-packed-coalesce-miniblocks branch from fa243dd to 9174897 Compare September 10, 2026 19:32
@prtkgaur
prtkgaur force-pushed the delta-binary-packed-coalesce-miniblocks branch 5 times, most recently from 0cd12d7 to e686ed5 Compare September 18, 2026 21:09
The output buffer may alias decoder members of the same type, forcing repeated
reloads after stores. Keep the frame and running value in locals, write back
once, and preserve unsigned wrapping during reconstruction.
@prtkgaur
prtkgaur force-pushed the delta-binary-packed-coalesce-miniblocks branch from 443a6d4 to 4e3c46f Compare October 4, 2026 00:13
Adjacent equal-width miniblocks form one packed stream. Decode each run with one
unpack call, bounded by the current block and output request; retain the
zero-width path and cover width changes, partial reads, block boundaries, and
both integer widths.
@prtkgaur
prtkgaur force-pushed the delta-binary-packed-coalesce-miniblocks branch from 4e3c46f to b710c74 Compare October 4, 2026 02:36
@prtkgaur prtkgaur changed the title GH-51268: [C++][Parquet] Unpack equal-width DELTA_BINARY_PACKED miniblocks in one call [WIP][POC] GH-51268: [C++][Parquet] Unpack equal-width DELTA_BINARY_PACKED miniblocks in one call Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants