Serge Rielau created SPARK-45595:
------------------------------------

             Summary: Expose SQLSTATRE in errormessage
                 Key: SPARK-45595
                 URL: https://issues.apache.org/jira/browse/SPARK-45595
             Project: Spark
          Issue Type: Improvement
          Components: Spark Core
    Affects Versions: 4.0.0
            Reporter: Serge Rielau


When using spark.sql.error.messageFormat in MINIMAL or STANDARD mode the 
SQLSTATE is exposed;
We want to extend this to PRETTY mode, now that all errors have SQLSTATEs

We propose to trail the SQLSTATE after the text message, so it does not take 
away from the reading experience of the message, while still being easily found 
by tooling or humans.
[<errorClass>] <message> SQLSTATE: <state>
<context>

Example:


{{[DIVIDE_BY_ZERO] ** Division by zero. Use `try_divide` to tolerate divisor 
being 0 and return NULL instead. If necessary set "spark.sql.ansi.enabled" to 
"false" to bypass this error. SQLSTATE: 22013}}
{{{}== SQL(line 1, position 8){}}}{{{}==
{}}}{{{}SELECT 1/0
{}}}{{       ^^^}}

Other options considered have been:
{{[DIVIDE_BY_ZERO](22013) ** Division by zero. Use `try_divide` to tolerate 
divisor being 0 and return NULL instead. If necessary set 
"spark.sql.ansi.enabled" to "false" to bypass this error. }}
{{{}== SQL(line 1, position 8){}}}{{{}==
{}}}{{{}SELECT 1/0
{}}}{{       ^^^}}


{{and}}

{{{{[DIVIDE_BY_ZERO] ** Division by zero. Use `try_divide` to tolerate divisor 
being 0 and return NULL instead. If necessary set "spark.sql.ansi.enabled" to 
"false" to bypass this error.}}
{{{}== SQL(line 1, position 8){}}}{{{}=={}}}
{{SELECT 1/0}}
{{       ^^^}}
{{{{SQLSTATE: 22013}}}}
}}{{{}{{}}{}}}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to