You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "David Wayne Birdsall (JIRA)" <ji...@apache.org> on 2019/04/24 20:02:00 UTC

[jira] [Resolved] (TRAFODION-3300) ROUND function on extreme data types fails with numeric overflows

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

David Wayne Birdsall resolved TRAFODION-3300.
---------------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4

> ROUND function on extreme data types fails with numeric overflows
> -----------------------------------------------------------------
>
>                 Key: TRAFODION-3300
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-3300
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp, sql-exe
>    Affects Versions: 2.4
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>            Priority: Major
>             Fix For: 2.4
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> The following script reproduces the failures.
> {quote}drop table if exists t;
> create table t (
> c1 numeric(128),
> c2 numeric(128,1),
> c3 numeric(128,2));
> insert into t values (
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678,
> 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.8,
> 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456.78
> );
> select * from t;
> select ROUND(c1, 1) from t;
> select ROUND(c2, 1) from t;
> select ROUND(c3, 1) from t;
> select ROUND(c1, 2) from t;
> select ROUND(c2, 2) from t;
> select ROUND(c3, 2) from t;
> select ROUND(c1, 3) from t;
> select ROUND(c2, 3) from t;
> select ROUND(c3, 3) from t;
> {quote}
> When run, some of the ROUND functions fail with numeric overflows. They all should execute successfully.
> {quote}>>drop table if exists t;
> --- SQL operation complete.
> >>create table t (
> +>c1 numeric(128),
> +>c2 numeric(128,1),
> +>c3 numeric(128,2));
> --- SQL operation complete.
> >>
> >>insert into t values (
> +>12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678,
> +>1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.8,
> +>123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456.78
> +>);
> --- 1 row(s) inserted.
> >>select * from t;
> C1 C2 C3
> --------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567.8 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456.78
> --- 1 row(s) selected.
> >>
> >>select ROUND(c1, 1) from t;
> (EXPR)
> ---------------------------------------------------------------------------------------------------------------------------------
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
> --- 1 row(s) selected.
> >>select ROUND(c2, 1) from t;
> *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,129 BYTES,ISO88591) Source Value:123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456780 to Target Type:NUMERIC(REC_NUM_BIG_SIGNED).
> --- 0 row(s) selected.
> >>select ROUND(c3, 1) from t;
> (EXPR)
> ----------------------------------------------------------------------------------------------------------------------------------
> 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456.80
> --- 1 row(s) selected.
> >>
> >>select ROUND(c1, 2) from t;
> (EXPR)
> ---------------------------------------------------------------------------------------------------------------------------------
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
> --- 1 row(s) selected.
> >>select ROUND(c2, 2) from t;
> *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,130 BYTES,ISO88591) Source Value:1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567800 to Target Type:NUMERIC(REC_NUM_BIG_SIGNED).
> --- 0 row(s) selected.
> >>select ROUND(c3, 2) from t;
> *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,129 BYTES,ISO88591) Source Value:123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456780 to Target Type:NUMERIC(REC_NUM_BIG_SIGNED).
> --- 0 row(s) selected.
> >>
> >>select ROUND(c1, 3) from t;
> (EXPR)
> ---------------------------------------------------------------------------------------------------------------------------------
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
> --- 1 row(s) selected.
> >>select ROUND(c2, 3) from t;
> *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,131 BYTES,ISO88591) Source Value:12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678000 to Target Type:NUMERIC(REC_NUM_BIG_SIGNED).
> --- 0 row(s) selected.
> >>select ROUND(c3, 3) from t;
> *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,130 BYTES,ISO88591) Source Value:1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567800 to Target Type:NUMERIC(REC_NUM_BIG_SIGNED).
> --- 0 row(s) selected.
> >>exit;
> End of MXCI Session
> {quote}



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