Shorten cast and array temporary lifetimes [databricks] #16745
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 316 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.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16745"
general
weight: 0.35
wjxiz1992
JaCoCo production line coverage: +42 lines (
sql-plugin +42; covered added/changed lines in one focused Spark 3.3 / Scala 2.12 run; other JVM modules: N/A, no changed production lines.)Contributes to #15997.
Description
Floating timestamp casts and array minima hold owning temporary columns across later allocations. This refactor closes those columns after their last use. Array removal now builds the comparison, inverted, and list masks in separate owning stages, closing the expanded RHS before the latter two stages. Query results and cuDF transformations are unchanged.
Array zip reuses
replaceListChildto preserve the padded input's offsets and validity. Seven local lint reasons explain the retained operands, borrowed views, and cleanup scopes, accounting for the 12 cast/collection baseline findings. The window package is handled by #16608.Covered by existing
CastOpSuite,AnsiCastOpSuite,CollectionOpSuite,array_test.py::test_array_min_max,array_test.py::test_array_remove,array_test.py::test_arrays_zip,array_test.py::test_arrays_zip_corner_cases, and timestamp-cast cases incast_test.py.Performance
A native probe compared main 954c9d4 with this change on RTX 5880 Ada / JDK 17, using the default CUDA allocator. It used 65,536 rows, 16 elements per array, four JVMs (original/refactored/refactored/original), and three peak samples per JVM. The table reports RMM-tracked additional allocated bytes above the retained inputs; array removal's full-call peak is unchanged in this workload.
| Operation | Original peak (bytes) | Refactored peak (bytes) |
| --- | ---: | ---: |
| array_min(double) | 10,969,092 | 9,920,516 |
| array_min(float) | 6,250,500 | 5,201,924 |
| array_remove(long) | 22,020,105 | 22,020,105 |
| double to timestamp | 2,129,925 | 1,065,060 |
| float to timestamp | 2,138,117 | 1,064,977 |
AI assistance: The change, local validation probes, and PR description were prepared with Codex assistance.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance