← Back to Pull requests

perf: skip the `flatten` validity scan for non-null lists (2.80× faster) #7800

Open
unknown opened this pull request with 167 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 30, 2026 20:28 UTC
Author

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 None for the output null buffer in that case. At 8,192 rows this made flatten 2.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 CometArrayExpressionSuite passed.

<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.

Diff: 167 lines (+125 / -42) across 2 files Reviewer: comphead Review duration: 3006m
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
0.35
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
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
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% 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: 35.1% (MEDIUM) · Higher = larger blast radius
35.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: 46.7% · Lower = rushed or shallow review
46.7%
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: 18.7% · Safe to merge
18.7%