[ 
https://issues.apache.org/jira/browse/SPARK-38929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Apache Spark reassigned SPARK-38929:
------------------------------------

    Assignee: Apache Spark

> Improve error messages for cast failures in ANSI
> ------------------------------------------------
>
>                 Key: SPARK-38929
>                 URL: https://issues.apache.org/jira/browse/SPARK-38929
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.3.0
>            Reporter: Xinyi Yu
>            Assignee: Apache Spark
>            Priority: Major
>
> Improve several error messages for cast failures in ANSI.
> h2. Cast to numeric types
> {code:java}
> java.lang.NumberFormatException: invalid input syntax for type numeric: 1.0. 
> To return NULL instead, use 'try_cast'. ...{code}
> This is confusing as 1.0 is numeric to an average user. Need to mention the 
> specific target type (integer in this case) and put 1.0 in single quotes. If 
> we can mention this is a cast from string to an integer that’s even better.
> *Proposed change*
> {code:java}
> Invalid `int` literal: '1.0'. To return NULL instead, use 'try_cast'.{code}
> h2. Cast to date types
> {code:java}
> java.time.DateTimeException: Cannot cast 2021-09- 2 to DateType.{code}
> Can align with the above change.
> *Proposed change*
> {code:java}
> Invalid `date` literal: '2021-09- 2'. To return NULL instead, use 
> 'try_cast'.{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to