← Back to Pull requests

Guard AST JIT leaf types, fix null string/decimal literals, and allow string outputs #17113

Open
unknown opened this pull request with 463 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 24, 2026 05:13 UTC
Author

Fixes #17111. Contributes to #16385.

Description

Project AST JIT remains experimental and disabled by default (spark.rapids.sql.projectAstJitEnabled). Before extending AST JIT to additional operators (such as COALESCE, IF/CASE WHEN, IS NULL, and comparisons), this PR fixes latent leaf/literal bugs on main and prepares basic type handling:

  • Restrict GpuBoundReference.selfSupportsAstJit, GpuLiteral.selfSupportsAstJit, and GpuExpression.supportsAstJit (for AttributeReference) to data types supported by libcudf row_ir (Boolean, Byte, Short, Int, Long, Float, Double, Date, Timestamp, String, Decimal), instead of accepting unsupported types such as BinaryType or nested types.

  • Fix GpuLiteral.convertToAst to handle null StringType literals via ast.Literal.ofNull(DType.STRING) instead of throwing NullPointerException, and add DecimalType literal conversion (ast.Literal.ofDecimal / ast.Literal.ofNull) while keeping GpuLiteral.selfConvertsToAst aligned for DECIMAL32/DECIMAL64 (precision <= Decimal.MAX_LONG_DIGITS).

  • Pass transparent tagging/identity wrappers (GpuKnownNotNull, GpuKnownFloatingPointNormalized, GpuUnaryPositive, GpuAlias) through AST JIT without triggering compilation on their own.

  • Allow StringType outputs in GpuAstJitExpression.canUseAstJit and GpuProjectAstPlanner AST JIT regions (legacy interpreted AST remains restricted to fixed-width outputs).
  • Validation

    Spark 3.5.2 (buildver=352, NVIDIA RTX 5880 Ada):

  • Ran python3 build/check_shim_compatibility.py coverage: PASS (4,465 checked requirements, 0 findings).

  • Ran mvn -nsu -pl tests -Dbuildver=352 -Dtest=none -Dsurefire.failIfNoSpecifiedTests=false -DwildcardSuites=com.nvidia.spark.rapids.GpuProjectAstJitSuite,com.nvidia.spark.rapids.GpuProjectAstPlannerSuite test: 103 passed, 0 failed.

  • Ran mvn -N -Dbuildver=352 -Dspark.rapids.source.basedir=$PWD antrun:run@scalastyle-all-modules: 2,135 files checked, 0 errors, 0 warnings.

  • Not run locally: other Spark versions, Databricks runtimes, and Python integration tests on this standalone branch.
  • Performance

    Measured on Spark 3.5.2 (local[4], 8g pinned pool, NVIDIA RTX 5880 Ada, 200M-row INT32 Parquet table, 2 warmup + 5 measured iterations, median) using the depth-8 non-ANSI integral chain (-abs(((i0 + i1) - i2) - i3) 2 + k + i1 - i2). plain_ checks for no regression on existing AST JIT expressions; known_not_null_* wraps i0..i3 with Catalyst KnownNotNull (verified present as gpuknownnotnull in GpuProject), which previously fell back to regular GPU and now fuses into AST_JIT. Exact checksums matched across all runs:

    | Case | Regular GpuProject op (med) | AST JIT GpuProject op (med) | Project Op Speedup | Regular E2E (med) | AST JIT E2E (med) |
    |---|---:|---:|---:|---:|---:|
    | plain_1out | 88.2 ms | 24.8 ms | 3.56x | 1295.6 ms | 1253.4 ms |
    | plain_4out | 192.5 ms | 49.3 ms | 3.90x | 1343.9 ms | 1289.2 ms |
    | known_not_null_1out | 93.1 ms | 25.7 ms | 3.62x | 1320.5 ms | 1247.0 ms |
    | known_not_null_4out | 195.7 ms | 48.2 ms | 4.06x | 1318.3 ms | 1254.4 ms |

    AI assistance: An AI coding assistant helped draft the code, unit tests, benchmark script, and PR description; the author reviewed and verified the changes.

    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

  • 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: 463 lines (+347 / -116) across 5 files Reviewer: thirtiseven Review duration: 10619m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.46) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 463 lines diff across 5 files
    0.46
    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%
    42%
    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.367
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #17113"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 45.6% (MEDIUM) · Higher = larger blast radius
    45.6%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 26% · Safe to merge
    26%