You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Steshin (Jira)" <ji...@apache.org> on 2024/12/24 12:10:00 UTC

[jira] [Updated] (IGNITE-23414) Calcite. Fix cast of dynamic parameters.

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

Vladimir Steshin updated IGNITE-23414:
--------------------------------------
    Release Note: Fixed explicit casts of dynamic parameters with Calcite engine.

> Calcite. Fix cast of dynamic parameters.
> ----------------------------------------
>
>                 Key: IGNITE-23414
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23414
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.14
>            Reporter: Vladimir Steshin
>            Assignee: Vladimir Steshin
>            Priority: Major
>              Labels: calcite, ignite-2, ise
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Dynamic parameters aren't casted like literals.
> Reproducer:
> {code:java}
>         sql("CREATE TABLE t(id integer primary key, int_col integer)");
>         sql("insert into t values (1, 1)");
>         // OK
>         assertQuery("SELECT id from t where int_col=CAST('1' as INTEGER)").returns(1).check();
>         assertQuery("SELECT id from t where int_col=CAST('1' as TINYINT)").returns(1).check();
>         assertQuery("SELECT id from t where int_col=CAST(1 as TINYINT)").returns(1).check();
>         // OK
>         assertThrows("SELECT id from t where int_col=CAST(11111 as TINYINT)", ArithmeticException.class, "overflow");
>         assertThrows("SELECT id from t where int_col=CAST('11111' as TINYINT)", ArithmeticException.class, "overflow");
>         assertThrows("SELECT id from t where int_col=11111::TINYINT", ArithmeticException.class, "overflow");
>         assertThrows("SELECT id from t where int_col='11111'::TINYINT", ArithmeticException.class, "overflow");
>         // Fails
>         assertThrows("SELECT id from t where int_col=CAST(? as TINYINT)", ArithmeticException.class, "overflow", 1111);
>         assertThrows("SELECT id from t where int_col=CAST(? as TINYINT)", ArithmeticException.class, "overflow", "1111");
>         assertThrows("SELECT id from t where int_col=?::TINYINT", ArithmeticException.class, "overflow", 1111);
>         assertThrows("SELECT id from t where int_col=?::TINYINT", ArithmeticException.class, "overflow", "1111");
>         // Fails
>         assertQuery("SELECT id from t where int_col=CAST(? as TINYINT)").withParams('1').returns(1).check();
>         assertQuery("SELECT id from t where int_col=CAST(? as INTEGER)").withParams('1').returns(1).check();
> {code}
> Adoption of #IGNITE-18831



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