SEPURI-SAI-KRISHNA opened a new pull request, #59046:
URL: https://github.com/apache/spark/pull/59046

   ### 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)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to