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

Gengliang Wang resolved SPARK-28503.
------------------------------------
    Resolution: Won't Fix

After consideration, I decide to close this one and open 
https://issues.apache.org/jira/browse/SPARK-28741 The current behavior is 
actually compatible with Hive. The changes in this PR might break existing 
queries, while there is no similar behavior in other DBMS.
If users care about the overflow, they can use enable the configuration 
proposed in https://issues.apache.org/jira/browse/SPARK-28741.

> Return null result on cast an out-of-range value to a integral type
> -------------------------------------------------------------------
>
>                 Key: SPARK-28503
>                 URL: https://issues.apache.org/jira/browse/SPARK-28503
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Gengliang Wang
>            Priority: Major
>
> Currently, when we convert an out-of-range value to a numeric type, the value 
> is unexpected
> scala> spark.sql("select cast(327689 as short)").show()
> +------------------------+
> |CAST(327689 AS SMALLINT)|
> +------------------------+
> |                       9|
> +------------------------+
> The result is actually 327689.toShort  (327689 & 0xffff).
> For such cases, I think we should return null.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

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

Reply via email to