You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Gengliang Wang (JIRA)" <ji...@apache.org> on 2019/07/24 16:33:00 UTC

[jira] [Commented] (SPARK-28503) Return null result on cast an out-of-range value to a numeric type

    [ https://issues.apache.org/jira/browse/SPARK-28503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16891982#comment-16891982 ] 

Gengliang Wang commented on SPARK-28503:
----------------------------------------

I am working on this.

> Return null result on cast an out-of-range value to a numeric type
> ------------------------------------------------------------------
>
>                 Key: SPARK-28503
>                 URL: https://issues.apache.org/jira/browse/SPARK-28503
>             Project: Spark
>          Issue Type: Bug
>          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
(v7.6.14#76016)

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