You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2025/02/16 01:08:00 UTC

[jira] [Created] (CALCITE-6839) The SUM function sometimes throws overflow exceptions due to incorrect return types

xiong duan created CALCITE-6839:
-----------------------------------

             Summary: The SUM function sometimes throws overflow exceptions due to incorrect return types
                 Key: CALCITE-6839
                 URL: https://issues.apache.org/jira/browse/CALCITE-6839
             Project: Calcite
          Issue Type: Bug
            Reporter: xiong duan


 The SQL in dummy.iq:
{code:java}
!use scott
!set outputformat mysql

select sum(mgr) from emp;

!ok{code}
Because the data type of MGR is TINYINT, according to SUM's data type inference rules, the data type of SUM is also TINYINT.

This SQL throws the exception:
{code:java}
java.sql.SQLException: Error while executing SQL "select sum(mgr) from emp": Value 38835 out of range {code}



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