← Back to Pull requests

Fix Spark 5 ORC filter and file scan test compatibility [databricks] [reduced-it] #17199

Closed
unknown closed this pull request without merging on Dec 02, 2026 06:01 UTC
View on GitHub
unknown unknown commented on Dec 01, 2026 02:59 UTC
Author

Fixes #16702.
Fixes #17197.

Description

Spark 5 changed the JVM signature of OrcFilters.createFilter. Keeping that call in the shared sql-plugin-api wrapper would produce incompatible bytecode across Spark parallel worlds and could cause packaging failures or NoSuchMethodError at runtime.

This change moves the package-private call from the root-promoted sql-plugin-api module into ordinary sql-plugin source, which is compiled separately for every Spark parallel world. The shared source call omits the defaulted read-schema argument: pre-Spark-5 compilers emit the two-argument invocation, while Spark 5 supplies the default None and emits the three-argument invocation. Binary de-duplication retains the differing wrapper bytecode in the appropriate parallel worlds.

Spark's read-schema guard currently affects nanosecond timestamp types, which the GPU ORC scan rejects during planning and leaves to Spark's CPU reader. Preserving None therefore retains existing supported behavior and avoids building an additional schema map for every file split. If GPU ORC later supports these types, the call must pass both the per-file ORC schema and the actual requested read schema.

A later Spark 5 change also made the built-in ParquetScan.partitions implementation final, which prevented two scan-split test fixtures from compiling. The suites now share a planning-only FileScan fixture matching the production GPU scan hierarchy, while retaining Spark's ParquetScan as the comparison baseline.

There is no user-facing configuration or behavior change. This change restores Spark 5 build and test compatibility.

Performance validation compared Spark 5 ORC filter construction with and without the read schema while keeping the file schema and filter identical. Passing the read schema added about 3.4 microseconds per call for a 10-column schema, 50 microseconds for a 100-column read schema over a 1000-column file schema, and 531 microseconds for a 1000-column read schema. The final implementation passes no read schema and therefore retains the previous construction path without this additional per-split work.

Validation completed:

  • Spark 3.3 / Scala 2.12: HistorySizedFileScanSuite and ScanSplitResizeSuite, 9 tests passed.

  • Spark 4.2 / Scala 2.13: the same 9 tests passed.

  • Spark 5 / Scala 2.13 / JDK 21, with the existing javac warning workarounds tracked by #16991: all 42 final sql-plugin test sources compiled and the same 9 tests passed.

  • Package/main compilation passed for Spark 3.3 and 4.2; Spark 5 main compilation passed. Generated bytecode was inspected to confirm the expected two-argument and defaulted three-argument invocations.

  • A broader Spark 5 sql-plugin run passed 323 of 324 tests; the remaining unrelated ClassInitializationSuite test uses Thread.suspend, which JDK 21 rejects.

  • A Spark 5 GPU ORC smoke test returned the expected filtered row and confirmed a GPU batch scan with the equality predicate in PushedFilters.

  • Databricks 17.3 and 18.3 runtime inspection confirmed that their Spark builds still expose the two-argument API.

  • Scala 2.12 and 2.13 all-module scalastyle checks passed.

  • Shim compatibility review against the current target branch passed with no new findings.

  • The full Spark 5 tests module remains blocked by an unrelated existing GpuRangeBoundaryPythonIslandSuite constructor compatibility issue.
  • This change was developed with AI 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

  • 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: 479 lines (+359 / -120) across 5 files Reviewer: firestarman Review duration: 1622m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 479 lines diff across 5 files
    0.46
    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.369
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #17199"
    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: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    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: 19.8% · Safe to merge
    19.8%