feat(parquet): stream-encode definition/repetition levels incrementally #9447
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9447"
general
weight: 0.35
brunal
Which issue does this PR close?
Rationale for this change
When writing a Parquet column with very sparse data,
GenericColumnWriteraccumulates unbounded memory for definition and repetition levels. The rawi16values are appended intoVec<i16>sinks on everywrite_batchcall and only RLE-encoded in bulk when a data page is flushed. For a column that is almost entirely nulls, the actual RLE-encoded output can be tiny, yet the intermediate buffer grows linearly with the number of rows.What changes are included in this PR?
Replace the two raw-level
Vec<i16>sinks (def_levels_sink/rep_levels_sink) with streamingLevelEncoderfields (def_levels_encoder/rep_levels_encoder). Behavior is the same, but we keep running RLE-encoded state rather than the full list of rows in memory. Existing logic is reused.Are these changes tested?
Yes, all tests passing.
Benchmarks show no regression.
list_primitivebenches improved by 3-5%:Are there any user-facing changes?
None. Some internal symbols are now unused. I added some
#[allow(dead_code)]statements since these were experimental-visible and might be externally relied on.