Skip to content

GH-55849: [C++][Parquet] Avoid a redundant definition level scan in spaced reads of repeated fields - #55850

Merged
wgtmac merged 1 commit into
apache:mainfrom
HuaHuaY:avoid_def_scan
Dec 1, 2026
Merged

wgtmac merged 1 commit into
apache:mainfrom
HuaHuaY:avoid_def_scan

Conversation

@HuaHuaY

@HuaHuaY HuaHuaY commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

When reading a repeated field, DelimitRecords() scans the definition levels to count non-null values. For spaced reads, the reader then visits the same levels to build the validity bitmap. That step already provides the non-null count, so the first scan is redundant.

What changes are included in this PR?

Remove the counting logic from DelimitRecords.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Copilot AI balanced review requested due to automatic review settings November 30, 2026 09:32

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.

🟢 Approval recommended

No active review issues are reported for the repeated-field spaced-read optimization.

No open issues 🎉

What changed in this PR

Optimizes repeated-field spaced reads in the C++ Parquet reader by removing a redundant definition-level scan, addressing #55849 without changing public APIs.

Changes:

  • Limits DelimitRecords() to scanning repetition levels and tracking record boundaries.
  • Preserves explicit value counting for dense reads and skips, while spaced reads rely on the existing validity-bitmap pass.
File Description
cpp/​src/​parquet/​column_reader.cc Removes counting from record delimiting and shares the dense-read helper between optional and repeated fields.

Review effort: Balanced

@wgtmac
wgtmac merged commit 2886a55 into apache:main Dec 1, 2026
61 of 82 checks passed
@wgtmac

wgtmac commented Dec 1, 2026

Copy link
Copy Markdown
Member

Thanks @HuaHuaY for working on this and @pitrou for the review!

@HuaHuaY
HuaHuaY deleted the avoid_def_scan branch December 1, 2026 05:40
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.

[C++][Parquet] Avoid scanning definition levels twice in spaced reads of repeated fields

4 participants