You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Runkang He (Jira)" <ji...@apache.org> on 2023/09/09 06:02:00 UTC
[jira] [Updated] (CALCITE-5990) Explicit cast to numeric type doesn't check overflow
[ https://issues.apache.org/jira/browse/CALCITE-5990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Runkang He updated CALCITE-5990:
--------------------------------
Description:
Explicit cast to numeric type doesn't check overflow, and this issue can be reproduced by sqlline:
{code:sql}
select cast(empno as tinyint), cast(130 as tinyint) from emps where name='Alice'; -- empno is 130
{code}
The empno is INT type. The result is:
{code:sql}
-126, -126{code}
I think it should throw exception when overflow.
At last, this issue was found when to turn on runtime check for CalciteSqlOperatorTest in CALCITE-5921.
was:
Explicit cast to numeric type doesn't check overflow, and this issue can be reproduced by sqlline:
{code:sql}
select cast(empno as tinyint), cast(130 as tinyint) from emps where name='Alice'; -- empno is 130
{code}
The result is:
{code:sql}
-126, -126{code}
I think it should throw exception when overflow.
At last, this issue was found when to turn on runtime check for CalciteSqlOperatorTest in CALCITE-5921.
> Explicit cast to numeric type doesn't check overflow
> ----------------------------------------------------
>
> Key: CALCITE-5990
> URL: https://issues.apache.org/jira/browse/CALCITE-5990
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.35.0
> Reporter: Runkang He
> Assignee: Runkang He
> Priority: Major
>
> Explicit cast to numeric type doesn't check overflow, and this issue can be reproduced by sqlline:
> {code:sql}
> select cast(empno as tinyint), cast(130 as tinyint) from emps where name='Alice'; -- empno is 130
> {code}
> The empno is INT type. The result is:
> {code:sql}
> -126, -126{code}
> I think it should throw exception when overflow.
> At last, this issue was found when to turn on runtime check for CalciteSqlOperatorTest in CALCITE-5921.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)