Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Required, non-repeated columns still compress the unpopulated uncompressed_data_ buffer instead of the encoded values, producing invalid compressed V1 pages with mismatched declared uncompressed sizes.
1 open issue
What changed in this PR
This PR reduces unnecessary buffer copying when the C++ Parquet writer builds data pages.
Changes:
- Reuses the values buffer for uncompressed V1 pages without definition or repetition levels.
- Removes an unused buffer copy when buffering dictionary-encoded V2 pages.
| File | Description |
|---|---|
cpp/src/parquet/column_writer.cc |
Avoids redundant copies in V1 and V2 data-page construction. |
Review effort: Balanced
HuaHuaY
force-pushed
the
avoid_useless_copy
branch
from
October 29, 2026 04:08
fb71ca5 to
d5297ba
Compare
HuaHuaY
force-pushed
the
avoid_useless_copy
branch
from
October 29, 2026 04:08
d5297ba to
67ccca0
Compare
wgtmac
approved these changes
Oct 29, 2026
pitrou
reviewed
Oct 29, 2026
| // if dictionary encoding has fallen back to PLAIN | ||
| if (has_dictionary_ && !fallback_) { // Save pages until end of dictionary encoding | ||
| PARQUET_ASSIGN_OR_THROW(auto data_copy, | ||
| combined->CopySlice(0, combined->size(), allocator_)); |
Contributor
Author
There was a problem hiding this comment.
I checked the git history and suspect that the author of BuildDataPageV2 copied BuildDataPageV1 and modified it, failing to notice the unused variable. Meanwhile, clang-tidy didn't flag any warning here either.
HuaHuaY
force-pushed
the
avoid_useless_copy
branch
from
October 29, 2026 09:31
67ccca0 to
da8eb30
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Rationale for this change
Avoid two unnecessary buffer copies.
What changes are included in this PR?
BuildDataPageV1uses thevaluesbuffer directly when there are no definition or repetition levels.BuildDataPageV2removes the unnecessarily copy ofcombinedwhen buffering dictionary-encoded pages.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:
Reviewed before submission by: