← Back to Pull requests

[SPARK-59785][CONNECT][TESTS] Fix SparkConnectResultSetSuite failure when ANSI mode is off #59046

Closed
unknown closed this pull request without merging on Sep 28, 2026 07:14 UTC
View on GitHub
unknown unknown commented on Sep 25, 2026 17:24 UTC
Author

What changes were proposed in this pull request?

This PR makes the test next throws SQLException when the query fails during result streaming in SparkConnectResultSetSuite enable spark.sql.ansi.enabled explicitly for its JDBC session before running the query, instead of relying on the default ANSI setting.

This follows the existing pattern in SparkConnectJdbcDataTypeSuite, which enables session configs with statement.execute("SET ...").

Why are the changes needed?

The test was added in SPARK-57933. It runs SELECT 10 / (5 - id) FROM range(10) and expects a DIVIDE_BY_ZERO error (SQLSTATE 22012), which is only raised under ANSI mode. The Non-ANSI scheduled builds (master, branch-4.x and branch-4.3) set SPARK_ANSI_SQL_MODE=false, so the division returns NULL and the test fails every time:

- next throws SQLException when the query fails during result streaming *** FAILED ***
  Expected exception java.sql.SQLException to be thrown, but no exception was thrown (SparkConnectResultSetSuite.scala:195)

Each JDBC connection creates its own Spark Connect session (SparkConnectConnection), and withStatement opens a new connection, so the setting does not leak to other tests.

Does this PR introduce _any_ user-facing change?

No. Test-only change.

How was this patch tested?

  • Before the fix, SPARK_ANSI_SQL_MODE=false build/sbt 'connect-client-jdbc/testOnly *SparkConnectResultSetSuite' fails with the same error as CI.

  • After the fix, the suite passes with both SPARK_ANSI_SQL_MODE=false and SPARK_ANSI_SQL_MODE=true (6 tests each).

  • build/sbt 'connect-client-jdbc/test' with both SPARK_ANSI_SQL_MODE=false and SPARK_ANSI_SQL_MODE=true: all 65 tests passed each time.
  • Was this patch authored or co-authored using generative AI tooling?

    Generated-by: Claude Code (Claude Opus 5.5)

    Diff: 236 lines (+177 / -59) across 2 files Reviewer: SEPURI-SAI-KRISHNA Review duration: 3710m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 236 lines diff across 2 files
    0.37
    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%
    60%
    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.327
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #59046"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 14.7% · Safe to merge
    14.7%
    Repository