← Back to Pull requests

Shorten cast and array temporary lifetimes [databricks] #16745

Closed
unknown closed this pull request without merging on Nov 09, 2026 10:11 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 04:11 UTC
Author

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 replaceListChild to 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 in cast_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

  • Updated for new or modified user-facing features or behaviors

  • No user-facing change
  • Testing

  • Added or modified tests to cover new code paths

  • Covered by existing tests

  • (Please provide the names of the existing tests in the PR description.)
  • Not required
  • Performance

  • Tests ran and results are added in the PR description

  • Issue filed with a link in the PR description

  • Not required
  • Diff: 316 lines (+237 / -79) across 3 files Reviewer: wjxiz1992 Review duration: 6120m
    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
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    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
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 17.5% · Safe to merge
    17.5%