perf: skip the `flatten` validity scan for non-null lists (2.80× faster) #7800
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 167 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.307
Real PR Conversation Timeline
1 comments
"Review active on #7800"
general
weight: 0.35
comphead
Which issue does this PR close?
None.
Rationale for this change
When neither list level has nulls, every output list is valid. Null elements inside a list stay in the values buffer.
What changes are included in this PR?
Return
Nonefor the output null buffer in that case. At 8,192 rows this madeflatten2.80× faster on regular lists and 2.46× faster on ragged lists.How are these changes tested?
Added a sliced-list test with an empty row and a null element. The native expression tests and Spark’s
CometArrayExpressionSuitepassed.<details>
<summary>Criterion results</summary>
cargo bench --bench flatten, main (07caef5f) vs this change, AMD EPYC Genoa, x86-64-v3. Rust 1.99.1. Median of three runs per version. Ragged cases use a local extension with 0–8 lists per row, 0–8 values per list, 10% null leaves and, where indicated, 20% null lists at one level.| Case | main (µs) | PR (µs) | Speedup |
|---|---:|---:|---:|
|
flatten/int32/8192/all_null| 31.65 | 31.26 | 1.01× ||
flatten/int32/8192/no_nulls| 28.62 | 10.23 | 2.80× ||
flatten/int32/8192/sparse| 58.70 | 58.66 | 1.00× ||
flatten/ragged/inner_nulls| 55.35 | 48.70 | 1.14× ||
flatten/ragged/parent_nulls| 38.63 | 37.52 | 1.03× ||
flatten/ragged/valid| 25.14 | 10.20 | 2.46× |</details>
Drafted with OpenAI Codex.