← Back to Pull requests

GH-51097: Fix Parquet null counts for fixed-width leaves #51357

Closed
unknown closed this pull request without merging on Sep 26, 2026 10:25 UTC
View on GitHub
unknown unknown commented on Sep 16, 2026 12:43 UTC
Author

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. DefLevelsToBitmap intentionally excludes these repeated-ancestor nulls from its null_count. MaybeCalculateValidityBits was 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 incorrect null_count for the int32 leaf even though the encoded definition levels correctly represent the null and empty list entries.

What changes are included in this PR?

Update MaybeCalculateValidityBits to calculate the total null count from batch_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 int32 leaf under list<struct<...>>.

Are these changes tested?

Yes.

Added a regression test that verifies the int32 leaf reports:

null_count = 3
num_values = 2

The focused regression test passes:

StatisticsTest.FixedWidthLeafUnderListStructNullCount

The existing parquet-writer-test also 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_count for 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

  • GitHub Issue: #51097
  • Diff: 255 lines (+191 / -64) across 3 files Reviewer: AnuragRaut08 Review duration: 14261m
    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
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.1% (MEDIUM) · Higher = larger blast radius
    39.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.4% · Safe to merge
    15.4%
    Repository