Skip to content

GH-50421: [C++][Parquet] Add LevelDecoder Skip and Count#50422

Merged
pitrou merged 20 commits into
apache:mainfrom
AntoinePrv:rle-bitmap-skip
Jul 10, 2026
Merged

GH-50421: [C++][Parquet] Add LevelDecoder Skip and Count#50422
pitrou merged 20 commits into
apache:mainfrom
AntoinePrv:rle-bitmap-skip

Conversation

@AntoinePrv

@AntoinePrv AntoinePrv commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change

Adding new methods to the LevelDecoder to start reducing the complexity in ColumnReaderImplBase, TypedColumnReaderImpl, and TypedRecordReader.

What changes are included in this PR?

  • Simplify LevelDecoder members based on a single variant
  • Add LevelDecoder::Skip
  • Add LevelDecoder::CountUpTo
  • Simplify Skip implementation in TypedColumnReaderImpl
  • Add SkippableTypedDecoder to wrap TypedDecoder with the remaining usage of the scratch_for_skip_ buffer

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

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

@AntoinePrv AntoinePrv marked this pull request as ready for review July 8, 2026 15:12
Copilot AI review requested due to automatic review settings July 8, 2026 15:12
@AntoinePrv AntoinePrv requested review from pitrou and wgtmac as code owners July 8, 2026 15:12

Copilot AI 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.

Pull request overview

This PR extends Parquet C++ decoding by moving more “skip/count” functionality into LevelDecoder and underlying RLE/bit-packed utilities, with the goal of simplifying skip logic in column/record readers.

Changes:

  • Refactors LevelDecoder to a single std::variant-backed implementation and adds Skip / CountUpTo.
  • Reworks TypedColumnReaderImpl::Skip to skip within a page by advancing rep/def levels and skipping only the required physical values.
  • Adds/updates Arrow RLE/bit-packed decoder internals and tests for Advance / CountUpTo.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
cpp/src/parquet/column_reader.h Updates LevelDecoder public API/docs to add Skip and CountUpTo and hide implementation details behind a pimpl.
cpp/src/parquet/column_reader.cc Implements new LevelDecoder internals, introduces SkippableTypedDecoder, and simplifies TypedColumnReaderImpl::Skip.
cpp/src/arrow/util/rle_encoding_internal.h Adds Advance / CountUpTo plumbing, introduces BitPackedDecoder, and refactors run processing into ProcessValues.
cpp/src/arrow/util/rle_encoding_test.cc Adds targeted tests for CountUpTo and Advance behavior.

Comment thread cpp/src/arrow/util/rle_encoding_internal.h
Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc Outdated
Comment thread cpp/src/parquet/column_reader.cc Outdated
Comment thread cpp/src/parquet/column_reader.h Outdated
Comment thread cpp/src/parquet/column_reader.cc Outdated
Comment thread cpp/src/arrow/util/rle_encoding_internal.h Outdated
Comment thread cpp/src/parquet/column_reader.h Outdated
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 9, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 08:46

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread cpp/src/arrow/util/rle_encoding_internal.h Outdated
Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc Outdated
Comment thread cpp/src/parquet/column_reader.cc
Copilot AI review requested due to automatic review settings July 9, 2026 08:52
@pitrou

pitrou commented Jul 9, 2026

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@rok

rok commented Jul 9, 2026

Copy link
Copy Markdown
Member

Benchmark runs are scheduled for commit b7bd198. Watch https://buildkite.com/apache-arrow and https://conbench.arrow-dev.org for updates. A comment will be posted here when the runs are complete.

Copilot AI review requested due to automatic review settings July 9, 2026 15:19

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc
@AntoinePrv

Copy link
Copy Markdown
Collaborator Author

@pitrou this is ready again.

Comment thread cpp/src/arrow/util/rle_encoding_internal.h

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple minor comments, otherwise LGTM

Comment thread cpp/src/arrow/util/rle_encoding_test.cc Outdated
Comment thread cpp/src/arrow/util/rle_encoding_test.cc Outdated
Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/arrow/util/rle_encoding_internal.h Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 16:47

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc
Comment thread cpp/src/parquet/column_reader.cc
@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 4 benchmarking runs that have been run so far on PR commit b7bd198.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

@AntoinePrv

Copy link
Copy Markdown
Collaborator Author

@pitrou this is looking good

Copilot AI review requested due to automatic review settings July 10, 2026 12:37

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +1250 to +1265
// Advance the definition levels, counting how many correspond to present
// (non-null) values that must be skipped in the data decoder.
int64_t non_null_values_to_skip = batch_size;
if (this->max_def_level() > 0) {
const auto count =
this->definition_level_decoder_.CountUpTo(this->max_def_level(), batch_size);
non_null_values_to_skip = count.matching_count;
ARROW_DCHECK_EQ(count.processed_count, batch_size);
}
// Advance the repetition levels; their values are not needed.
if (this->max_rep_level() > 0) {
this->repetition_level_decoder_.Skip(batch_size);
}
// Skip the corresponding data values.
this->current_decoder_.Skip(non_null_values_to_skip);

Comment on lines +387 to +390
/// Advance and count the number of occurrence of a values.
///
/// The count is limited to at most the next `batch_size` items.
/// @return The matching value count and number of of element that were processed.
@pitrou

pitrou commented Jul 10, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g cpp

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, this is ready to merge now :)

@github-actions

Copy link
Copy Markdown

Revision: 6e5c7a2

Submitted crossbow builds: ursacomputing/crossbow @ actions-2073a4b27b

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-debian-13-cpp-amd64 GitHub Actions
test-debian-13-cpp-i386 GitHub Actions
test-debian-experimental-cpp-gcc-15 GitHub Actions
test-fedora-42-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@pitrou pitrou merged commit 5815dc0 into apache:main Jul 10, 2026
60 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jul 10, 2026
@AntoinePrv AntoinePrv deleted the rle-bitmap-skip branch July 10, 2026 14:51
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.

4 participants