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

Mihai Budiu commented on CALCITE-6111:
--------------------------------------

The bug seems to be in RexToLixTranslator.checkExpressionPadTruncate, which is 
called from RexToLixTranslator.translateCast.

This function does nothing for numeric casts, whereas it should generate code 
to produce an exception if the cast overflows the target type.

> Explicit cast from expression to numeric type doesn't check overflow
> --------------------------------------------------------------------
>
>                 Key: CALCITE-6111
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6111
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: Evgeny Stanilovsky
>            Assignee: Mihai Budiu
>            Priority: Major
>
> After [1] was implemented it is still possible to obtain erroneous result, 
> check:
> {code:java}
> SELECT cast(100+30 as tinyint);{code}
> result:
> {code:java}
> -126{code}
> [1] https://issues.apache.org/jira/browse/CALCITE-5990



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to