Aleksandar Trajković created SPARK-62384:
--------------------------------------------

             Summary: Report a structured error for a JDBC write without the 
dbtable option
                 Key: SPARK-62384
                 URL: https://issues.apache.org/jira/browse/SPARK-62384
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Aleksandar Trajković


A JDBC write that sets the `query` option instead of `dbtable`, e.g.

  df.write.format("jdbc").option("url", url).option("query", "SELECT 
...").save()

fails in JdbcOptionsInWrite with a bare `require`, so the user gets a plain 
IllegalArgumentException with no error condition or SQLSTATE:

  java.lang.IllegalArgumentException: requirement failed: Option 'dbtable' is 
required. Option 'query' is not applicable while writing.

Report it as a SparkIllegalArgumentException with a new error condition 
JDBC_WRITE_TABLE_OPTION_MISSING (SQLSTATE 42616) instead.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to