You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GH-51684: [C++][Parquet] Keep the CDC chunking state across row groups - #51685
The content-defined chunker was owned by the column writer, which is recreated for every row group, so the chunking state was reset at each row group boundary. See #51684.
What changes are included in this PR?
The file writer creates one chunker per leaf column and passes it to the column writers of every row group through a new ColumnWriter::Make() argument.
Are these changes tested?
Yes. IndependentOfRowGroupBoundaries writes the same table into one and into six row groups and expects the same page boundaries apart from the row group ends. The first commit adds it alone, failing without the fix.
Are there any user-facing changes?
Files with multiple row groups get different page boundaries, since the chunking continues across row groups.
ColumnWriter::Make() takes an optional chunker as its last argument. Existing calls still compile, but the ABI changes. With content-defined chunking enabled and no chunker it throws, so such column writers have to come from ParquetFileWriter.
A 1 GiB file of 128Mi random int64 values (PLAIN, snappy, default CDC options) compared with a copy that has 10 rows inserted at 20%. The ratio is the share of bytes left after deduplicating both files with the Xet chunker; 50% means the edited copy adds almost nothing.
Row groups
pyarrow 25.0.1
This PR
arrow-rs 58.4
8 × 16Mi rows
50.2%
50.1%
50.1%
32 × 4Mi rows
50.6%
50.4%
50.5%
128 × 1Mi rows
52.4%
51.6%
51.6%
512 × 256Ki rows
59.8%
56.4%
56.5%
2048 × 64Ki rows
84.8%
74.2%
74.2%
ParquetWriter.write() per 100k rows
75.2%
66.7%
64.3%*
Without CDC
86.3%
86.3%
86.3%
* arrow-rs doesn't start a row group per write call, so it writes 8 row groups where pyarrow writes 1343.
The page boundaries now match arrow-rs, which already keeps the chunker state across row groups.
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.
Claude Code wrote the code, tests and description under human direction.
Add regression test for CDC-enabled ColumnWriter::Make failure
cpp/src/parquet/column_writer.cc:784
The new public-factory failure path is not covered: the added row-group test only writes through ParquetFileWriter. Add a regression test that calls the existing four-argument ColumnWriter::Make with CDC-enabled properties and asserts this ParquetException, so this intentional public API behavior cannot silently change.
The column writer owns the content defined chunker and is recreated for every
row group, so the chunking state is reset at each row group boundary. Writing
the same table into one and into multiple row groups must give the same page
boundaries apart from the row group ends.
The column writer created the chunker for every column chunk, so the chunking
state was reset at each row group. The file writer now keeps one chunker per
leaf column and passes it to the column writers of all the row groups.
… previous column
The column ordinal and the column metadata fall out of step if closing the
previous column writer throws and NextColumn() is called again, but that isn't
specific to content defined chunking.
Thanks @wgtmac for reviewing! I addressed the issues, ready for another look.
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
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
The content-defined chunker was owned by the column writer, which is recreated for every row group, so the chunking state was reset at each row group boundary. See #51684.
What changes are included in this PR?
The file writer creates one chunker per leaf column and passes it to the column writers of every row group through a new
ColumnWriter::Make()argument.Are these changes tested?
Yes.
IndependentOfRowGroupBoundarieswrites the same table into one and into six row groups and expects the same page boundaries apart from the row group ends. The first commit adds it alone, failing without the fix.Are there any user-facing changes?
ColumnWriter::Make()takes an optional chunker as its last argument. Existing calls still compile, but the ABI changes. With content-defined chunking enabled and no chunker it throws, so such column writers have to come fromParquetFileWriter.Deduplication results
A 1 GiB file of 128Mi random int64 values (PLAIN, snappy, default CDC options) compared with a copy that has 10 rows inserted at 20%. The ratio is the share of bytes left after deduplicating both files with the Xet chunker; 50% means the edited copy adds almost nothing.
ParquetWriter.write()per 100k rows* arrow-rs doesn't start a row group per write call, so it writes 8 row groups where pyarrow writes 1343.
The page boundaries now match arrow-rs, which already keeps the chunker state across row groups.
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.
Claude Code wrote the code, tests and description under human direction.
PR code and description written by:
Reviewed before submission by:
🤖 Generated with Claude Code