sepuri sai krishna created SPARK-59785:
------------------------------------------

             Summary: Fix SparkConnectResultSetSuite failure when ANSI mode is 
off
                 Key: SPARK-59785
                 URL: https://issues.apache.org/jira/browse/SPARK-59785
             Project: Spark
          Issue Type: Test
          Components: Connect
    Affects Versions: 5.0.0
            Reporter: sepuri sai krishna


{{SparkConnectResultSetSuite}} test "next throws SQLException when the query 
fails during result streaming", added in SPARK-57933, fails in every Non-ANSI 
scheduled build (master, branch-4.x and branch-4.3):

{noformat}
- 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)
{noformat}

The test runs {{SELECT 10 / (5 - id) FROM range(10)}} and expects a 
{{DIVIDE_BY_ZERO}} error (SQLSTATE 22012). That error is only raised when ANSI 
mode is on. The Non-ANSI builds set {{SPARK_ANSI_SQL_MODE=false}}, so the 
division returns NULL and nothing is thrown.

Reproduce with:
{noformat}
SPARK_ANSI_SQL_MODE=false build/sbt 'connect-client-jdbc/testOnly 
*SparkConnectResultSetSuite'
{noformat}

Proposed fix: enable {{spark.sql.ansi.enabled}} explicitly for the test's JDBC 
session. Each JDBC connection uses its own Spark Connect session, so the 
setting does not leak to other tests.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to