You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Marios Trivyzas (Jira)" <ji...@apache.org> on 2021/10/19 08:17:00 UTC

[jira] [Updated] (FLINK-24588) Optimisation of chained cast calls can lead to unexpected behaviour

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

Marios Trivyzas updated FLINK-24588:
------------------------------------
    Priority: Minor  (was: Major)

> Optimisation of chained cast calls can lead to unexpected behaviour
> -------------------------------------------------------------------
>
>                 Key: FLINK-24588
>                 URL: https://issues.apache.org/jira/browse/FLINK-24588
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / Planner
>    Affects Versions: 1.15.0
>            Reporter: Marios Trivyzas
>            Priority: Minor
>
> Simplification of Cast chained calls can lead to unexpected behaviour:
> CAST(CAST(CAST(123456 AS TINYINT) AS INT) AS BIGINT)
> is simplified to 
> {noformat}
> CAST(123456 AS BIGINT){noformat}
> and returns *123456* with *BIGINT* data type, where the first inner cast as TINYINT should already fail because the value is out of range.
> For example, for PostgreSQL:
> {noformat}
> postgres=# select 123456::smallint::int::bigint;
> ERROR: smallint out of range
> {noformat}
> Corresponding issue has been create at calcite: https://issues.apache.org/jira/browse/CALCITE-4861



--
This message was sent by Atlassian Jira
(v8.3.4#803005)