← Back to Pull requests

Return null for get_json_object array indexes above Int.MaxValue #17217

Open
unknown opened this pull request with 470 lines diff across 5 files
View on GitHub
unknown unknown commented on Dec 01, 2026 04:17 UTC
Author

JaCoCo production line coverage: +8 lines (sql-plugin +8; shim 330, fix-line, GetJsonObjectLargeIndexSuite)

Fixes #17060.

Description

get_json_object on GPU failed the Spark task for an array index above Int.MaxValue, such as $[2147483648]. Spark parses that index as a long and returns SQL null because the element is missing. The GPU path passed the long into a 32-bit JNI instruction, which throws IllegalArgumentException: index is too large before the extraction kernel starts.

Indexes that do not fit in a 32-bit int are now treated as no match. The single get_json_object expression and a combined projection both produce a null column for that path and leave any sibling in-range path on the GPU. Indexes that fit, including Int.MaxValue, still go through the existing kernel. The JNI range check is unchanged, so a truncated index cannot silently select element 0.

An index that does not fit in a long still fails path parsing on both CPU and GPU. This does not change json_tuple.

Cold-path performance impact

The added check (GpuGetJsonObject.hasIndexBeyondInt, called only from GpuGetJsonObject.pathForJni) is strictly cold-path and does not run per row or per batch during steady-state execution:

  • Literal-only, depth-bounded input: GpuMiscExpressionOverrides requires path to be a literal string (TypeSig.lit(TypeEnum.STRING)), and GpuGetJsonObjectMeta.tagExprForGpu() rejects paths with more than JsonPathParser.MAX_PATH_DEPTH = 16 filtered instructions (at most 32 raw PathInstruction tokens before filterInstructionsForJni).

  • Combined projection (GetJsonObjectCombiner.multiGet): pathForJni executes once per expression during driver-side query planning when constructing GpuMultiGetJsonObject. The per-batch execution path (GpuMultiGetJsonObject.columnarEval) is unchanged.

  • Single-path expression (GpuGetJsonObject.doColumnar): pathForJni executes inside cachedInstructions.getOrElse { ... } at most once per task instance (on the first batch); all subsequent batches reuse cachedInstructions without re-scanning.

  • Hot-path invariance: For valid in-range paths, pathForJni returns the identical Option[List[PathInstruction]] and executes the exact same JNI/GPU kernel calls with zero additional allocations, branches, synchronization, or GPU memory usage. For out-of-range indexes (> Int.MaxValue), execution previously failed with IllegalArgumentException and now takes the existing null-column fast path without launching the extraction kernel.
  • Validation

    GetJsonObjectLargeIndexSuite passed on shim 330 with Java 17: 9 tests, 0 failures. It covers an in-range index, Int.MaxValue, the first index above it, leading zeros, Long.MaxValue, a nested miss, and two combined projections, and compares CPU and GPU results. Premerge CI (GitHub Actions and Blossom) passed on commit b9edb753383e.

    AI assistance: The change and PR description were prepared with Cursor 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
  • Cold-path only: pathForJni runs once during driver planning (GetJsonObjectCombiner.multiGet) or once per task (GpuGetJsonObject.doColumnar via cachedInstructions) on a depth-bounded literal path, leaving per-batch GPU execution unchanged (see Cold-path performance impact above).

    Diff: 470 lines (+352 / -118) across 5 files Reviewer: thirtiseven Review duration: 4057m
    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 · 470 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.368
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #17217"
    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.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    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.1% · Safe to merge
    26.1%