-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: Extract NDV (distinct_count) statistics from Parquet metadata #19957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xudong963
merged 12 commits into
apache:main
from
asolimando:asolimando/ndv-parquet-support
Mar 19, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a670f12
feat: Extract NDV (distinct_count) statistics from Parquet metadata
asolimando 929322b
Improve NDV propagation through statistics merge and projection
asolimando 7ad5ef9
fix: cargo fmt
asolimando 011aa6c
fix: update partition_statistics tests for NDV preservation
asolimando 86dad37
refactor: simplify distinct_count merge logic
asolimando 32289cb
refactor: add build_column_statistics method to StatisticsAccumulators
asolimando 68d6387
refactor: move ndv_tests imports to module level
asolimando 144b183
fix: update hash join partition_statistics test for NDV preservation …
asolimando 7506f01
Extract overlap-based NDV merge into shared utility
asolimando 5d37345
Add threshold for partial NDV extraction from Parquet row groups
asolimando 8265113
Revert NDV propagation through projections
asolimando c51490f
fix: cargo fmt
asolimando File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being moved from union.rs makes me wonder if this should be generalized to all operators.
Say rather than just merging two columns we were to merge three: A, B, C. This can result in different outcomes with the same columns being merged since the columns stats are smeared after the first merge.
Example:
I know that while in union.rs this problem still existed but it was more tightly scoped.
Is there a way we could make this more explicit in the documentation / plan follow up work to handle merging?
I would think that preserving the shape of the distinct values in some way after merging is what we want. This might require more plumbing and could come back to this.
Let me know your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have filed #20966 as it's indeed a nice improvement and I think this can be made associative if working with lists of column statistics, rather than merging pair-wise.
I wouldn't consider this a problem for the current PR as the error is still reasonably bounded due to the uniform distribution of NDVs that our formulas rely on anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice nice, this makes sense.
I will also have a peak and some thoughts on that issue. Thank you for all the thoughtful responses and explanations 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to you and to all other reviewers, great discussions!