GH-55733: [C++][Compute][Parquet] Avoid redundant metadata copies #55647
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
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.333
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #55647"
general
weight: 0.35
pitrou
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?
const auto&when the values are only read, avoiding unnecessary copies.size() == 0andsize() > 0checks withempty()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.Are these changes tested?
No runtime tests were run locally.
I ran
git diff --checksuccessfully. 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:
Reviewed before submission by: