GH-3585: Fix DataPageHeaderV2.num_nulls=-1 when column statistics are disabled#3586
Open
keuin wants to merge 1 commit into
Open
GH-3585: Fix DataPageHeaderV2.num_nulls=-1 when column statistics are disabled#3586keuin wants to merge 1 commit into
keuin wants to merge 1 commit into
Conversation
wgtmac
reviewed
May 25, 2026
| this.nullCount = 0; | ||
| this.statistics = statisticsEnabled | ||
| ? Statistics.createStats(path.getPrimitiveType()) | ||
| : Statistics.noopStats(path.getPrimitiveType()); |
Member
There was a problem hiding this comment.
Is it possible to change Statistics.noopStats to make it possible to ignore min/max stats but still collects null count?
Author
There was a problem hiding this comment.
It's possible, but putting it outside Statistics is a design choice. By reading code I think the Statistics object is a 1:1 mapping to parquet header's statistics object, which is optional and may be disabled by user.
Putting counter of num_nulls outside statistics object makes the code clearer, because the code maps clearly to parquet header structure.
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
Fix the num_nulls field in DataPageHeaderV2, which will be unexpectedly set to -1 when statistics is disabled.
What changes are included in this PR?
Add a counter tracker in ColumnValueCollector, which is always enabled, to track required field num_nulls.
Are these changes tested?
Yes, tested. The test will fail before this fix, and will succeed with this fix.
Are there any user-facing changes?
No user-facing or API changes.
Closes #3585