GH-51097: Fix Parquet null counts for fixed-width leaves #51357
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 255 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #51357"
general
weight: 0.35
AnuragRaut08
Rationale for this change
Parquet null-count statistics can be incorrect for fixed-width leaf columns nested below a repeated ancestor, such as
list<struct<...>>.When a list is null or empty, its descendant leaf does not produce a value in the leaf values buffer.
DefLevelsToBitmapintentionally excludes these repeated-ancestor nulls from itsnull_count.MaybeCalculateValidityBitswas using that value directly for the Parquet column statistics, causing the null count to be undercounted.For example, a
list<struct<string, int32>>column can report an incorrectnull_countfor theint32leaf even though the encoded definition levels correctly represent the null and empty list entries.What changes are included in this PR?
Update
MaybeCalculateValidityBitsto calculate the total null count frombatch_size - out_values_to_write.This includes nulls represented by repeated ancestors, such as null or empty lists, while preserving the existing validity bitmap behavior.
Add a regression test covering a fixed-width
int32leaf underlist<struct<...>>.Are these changes tested?
Yes.
Added a regression test that verifies the
int32leaf reports:null_count = 3num_values = 2The focused regression test passes:
StatisticsTest.FixedWidthLeafUnderListStructNullCountThe existing
parquet-writer-testalso passes.Are there any user-facing changes?
Yes. This fixes incorrect Parquet column statistics for affected nested fixed-width columns. The change does not alter the encoded data or public APIs.
This PR contains a "Critical Fix".
This fixes a bug that produces incorrect Parquet statistics. The underlying data remains correct, but the reported
null_countfor affected fixed-width leaf columns can be incorrect.Was AI used for this PR?
PR code and description written by:
[x] Human
[ ] AI
Reviewed before submission by:
[x] Human
[ ] AI
[ ] Not reviewed