Support more non-ANSI integral arithmetic in Project AST JIT [databricks] #16677
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 542 lines diff across 6 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.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16677"
general
weight: 0.35
wjxiz1992
Contributes to #16676.
Description
Project AST JIT supported only non-ANSI INT/LONG addition and multiplication. Project AST JIT stays experimental and disabled by default (
spark.rapids.sql.projectAstJitEnabled). When it is enabled, this PR extends it to:Add,Subtract,Multiply,UnaryMinusandAbson byte, short, int and long in non-ANSI mode. They keep Spark's wrapping semantics. cuDF narrows every intermediate to its declared type, so byte and short wrap at each step like Spark, includingabsof a wrapped intermediate.int_col + long_col, no longer split it into a separate tier. A widening cast counts towardmaxGroupOpslike other operations, but a cast alone is not compiled.ANSI arithmetic is not included. cuDF's checked JIT operators can detect an overflow, but a JIT evaluation error reports only its error code, not the failing row or operation. The plugin needs those to raise the same Spark error as the regular GPU path. NVIDIA/cudf#24944 requests that information, and #16676 tracks ANSI support. Floating point is still excluded, because cuDF contracts
a b + cinto an FMA in JIT kernels (NVIDIA/cudf#24942).Planner tests that used integral subtraction as an expression JIT does not support now use bitwise operations,
greatest, or float subtraction instead. Integral subtraction no longer leaves a simple-arithmetic legacy consumer that shares a subtree with a JIT consumer, so that test now checks that both consumers share the subtree in one JIT program.Tests:
GpuProjectAstJitSuitecovers selection for each integral type, exclusion of each operator in ANSI and floating-point modes, widening casts staying inside a JIT region, and their count toward the group operation limit. It also runs JIT programs on the GPU and compares them with the regular GPU path at type boundaries for long, byte and short, includingabsof a wrapped intermediate.GpuProjectAstPlannerSuitecovers selection and sharing with the new operations.ast_test.pyadds wrapping arithmetic for byte, short, int and long, and+,-andbetween each narrower and wider integral type. Like the other JIT tests, they are expected to fail on Dataproc Serverless (#16778).Ran on Spark 3.5.2 (
buildver=352):mvn test -Dbuildver=352 -DwildcardSuites=GpuProjectAstJitSuite,GpuProjectAstPlannerSuite,GpuBroadcastHashJoinPostProjectionSuite,ProjectExprSuite,GpuArrayHofFusionSuite: 122 passed.TESTS=ast_test.py ./integration_tests/run_pyspark_from_build.sh: 230 passed, 1 xpassed (test_columnar_pow, unrelated).Not run locally: other Spark versions, Databricks, and the full integration test suite.
Performance
Hot run with a warm kernel cache, 200M rows of four INT32 columns read from Parquet,
local[4], 8 GB pinned pool, RTX 5880 Ada. The expression is the depth-8 chain-abs(((i0 + i1) - i2) - i3) * 2 + k + i1 - i2with one or four outputs (differentk), followed bysum. Without this PR only part of it can use JIT. Medians of 5 iterations after 2 warmups, one process. Op time is Project op time summed across the 4 concurrent tasks. Results matched. These runs used an earlier revision of this branch that also had ANSI support; the non-ANSI path measured here is unchanged.| Outputs | Project op time, regular → JIT (ms) | End to end, regular → JIT (ms) |
|---:|---:|---:|
| 1 | 96.7 → 27.2 | 1305.2 → 1275.5 |
| 4 | 195.7 → 48.8 | 1318.1 → 1256.8 |
End-to-end savings are close to the op-time savings divided by the 4 concurrent tasks; the rest of this query is mostly the Parquet scan. Cold-start compilation of the new kernels was not measured; #16383 tracks cold-start cost.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance