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

Marios Trivyzas commented on FLINK-24420:
-----------------------------------------

On one hand, it would be nice and would provide flexibility to have this as a 
separate option from the cast legacy behaviour.

On the other hand, what would be the default value? If we choose *FAIL* which 
makes sense overall, then if the default is {*}LegacyBehaviour = ENABLED{*}, 
this

should wrap the exception and return null, so we won't have the current 
behaviour of overflow tight together with cast legacy behaviour.

We can also choose to have *OVERFLOW* as the default, but this is yet another 
config option that we should change its default value in the future to the more

"correct" behaviour of *FAIL* which doesn't hide potential issues.

> Casting to a "narrower" type doesn't throw exception but follows Java overflow
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-24420
>                 URL: https://issues.apache.org/jira/browse/FLINK-24420
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Marios Trivyzas
>            Priority: Major
>
> Ideally we should provide config option to be able to keep current behaviour 
> where such casts follow the standard Java overflow, but in order to avoid 
> "hidden" erroneous behaviour the user should be able to have an error thrown 
> when an overflow happens. So basically range checks for each type like 
> TINYINT, SMALLINT, INT, FLOAT should be enforced. Keep in mind of such range 
> checks for every conversion would add performance overhead.



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

Reply via email to