Repository navigation
fix(parquet): preserve distinct-count invalidation across page flushes - #11264
Merged
Merged
Conversation
Caller-supplied distinct counts describe a write, while column metadata describes the whole column chunk. Once prior data lacks a usable distinct count, a later write cannot safely restore one. The writer currently checks `self.encoder.num_values() == 0` to detect whether data was already written. That count resets on page flush, so a later write can incorrectly replace an unknown column-wide count with its own batch count. Use column and page metrics instead to detect prior data, and only accept a supplied distinct count for the first write. Update the regression test to force a page boundary and verify that the column-wide distinct count remains absent while page statistics stay correct. Signed-off-by: Hippolyte Barraud <[email protected]>
etseidl
approved these changes
Sep 28, 2026
etseidl
left a comment
Contributor
There was a problem hiding this comment.
Thanks @HippoBaro. I verified the test fails on main.
cc @Rich-T-kid who may have an opinion here
Rich-T-kid
approved these changes
Sep 28, 2026
Rich-T-kid
left a comment
Contributor
There was a problem hiding this comment.
thanks for the cc @etseidl
makes sense to me. This is a neat fix, thanks @HippoBaro
Contributor
|
Thanks again @HippoBaro and @Rich-T-kid. |
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.
Which issue does this PR close?
Rationale for this change
Caller-supplied distinct counts describe an individual write, while column metadata describes the entire column chunk. Once earlier data makes the column-wide count unknown, a later write cannot safely restore that count using only its own batch statistics.
What changes are included in this PR?
Are these changes tested?
Yes. The updated regression covers distinct-count invalidation across a page flush and checks that page-level statistics are preserved.
Are there any user-facing changes?
There are no public API changes.