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

Tjomme Vergauwen commented on SPARK-42749:
------------------------------------------

Just checked the documentation again: the warning aparently was recently added

> CAST(x as int) does not generate error with overflow
> ----------------------------------------------------
>
>                 Key: SPARK-42749
>                 URL: https://issues.apache.org/jira/browse/SPARK-42749
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.2.1, 3.3.0, 3.3.1, 3.3.2
>         Environment: It was tested on a DataBricks environment with DBR 10.4 
> and above, running Spark v3.2.1 and above.
>            Reporter: Tjomme Vergauwen
>            Priority: Major
>         Attachments: Spark-42749.PNG
>
>
> Hi,
> When performing the following code:
> {{select cast(7.415246799222789E19 as int)}}
> according to the documentation, an error is expected as 
> {{7.415246799222789E19 }}is an overflow value for datatype INT.
> However, the value 2147483647 is returned. 
> The behaviour of the following is correct as it returns NULL:
> {{select try_cast(7.415246799222789E19 as int) }}
> This results in unexpected behaviour and data corruption.



--
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