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

Paul Rogers resolved IMPALA-7891.
---------------------------------
    Resolution: Fixed

> Analyzer does not detect numeric overflow in CAST
> -------------------------------------------------
>
>                 Key: IMPALA-7891
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7891
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>
> Consider the following SQL:
> {code:sql}
> SELECT CAST(257 AS TINYINT) AS c FROM functional.alltypestiny
> {code}
> Run this in the shell:
> {noformat}
> +----------------------+
> | cast(257 as tinyint) |
> +----------------------+
> | 1                    |
> +----------------------+
> {noformat}
> The SQL-2016 standard, section 4.4 states:
> bq. If an assignment of some number would result in a loss of its most 
> significant digit, an exception condition is raised.
> Expected an error rather than wrong result.
> This is not as simple as it appears. The BE is written in C which does not 
> detect integer overflow. So, one could argue that the behavior is correct: 
> Impala makes no guarantees about integer overflow.
> On the other hand, the math above is actually done in the planner; the 
> serialized plan contains an incorrect value. One could argue that the planner 
> should be more strict than the runtime, so that this is an error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to