← Back to Pull requests

GH-55733: [C++][Compute][Parquet] Avoid redundant metadata copies #55647

Closed
unknown closed this pull request without merging on Nov 23, 2026 07:38 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 09:51 UTC
Author

Rationale for this change

I opened a small cleanup PR yesterday while getting familiar with the Arrow codebase. While continuing to read through the code, I noticed that some of the same patterns addressed in that PR were also present in other related code paths.

The earlier PR fixed these patterns in one place, but similar cases remained elsewhere. This PR applies the same small improvements to those remaining occurrences.

I also found that the Parquet metadata builder copied the complete row-group metadata vector when finalizing file metadata. Since the builder is finalizing its state at that point, the row-group metadata can be moved into the final Thrift structure instead. This avoids an unnecessary allocation and copy, particularly for files with many row groups.

What changes are included in this PR?

  • Bind chunk and container metadata with const auto& when the values are only read, avoiding unnecessary copies.

  • Move row-group metadata into the finalized Parquet Thrift structure instead of copying the complete vector.

  • Replace size() == 0 and size() > 0 checks with empty() and !empty(). I used the same style in my previous PR and found more places where it made the intent clearer while reading through the codebase.

  • Keep the changes limited to small, behavior-preserving C++ cleanups.
  • Are these changes tested?

    No runtime tests were run locally.

    I ran git diff --check successfully. A configured C++ build directory was not available in the checkout, so I was not able to run the focused Arrow or Parquet tests locally.

    Are there any user-facing changes?

    No. There are no public API or serialized-format changes. The changes only avoid unnecessary copies and make existing container checks more direct.

    Was AI used for this PR?

    AI was used to help search through the codebase and inspect the relevant code paths. The changes and reasoning were reviewed before preparing this PR.

    PR code and description written by:

  • Human

  • AI
  • Reviewed before submission by:

  • Human

  • AI

  • Not reviewed
  • Diff: 261 lines (+195 / -66) across 3 files Reviewer: pitrou Review duration: 8507m
    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 · 261 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.333
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #55647"
    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.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    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.5% · Safe to merge
    15.5%
    Repository