[ 
https://issues.apache.org/jira/browse/CALCITE-6839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17928484#comment-17928484
 ] 

Julian Hyde edited comment on CALCITE-6839 at 2/19/25 4:10 PM:
---------------------------------------------------------------

I’m not sure that this is a bug. Yes, exceptions are tiresome. But what 
behavior would be better? Changing the type derivation is also problematic. 

I’m sure we have discussed type derivation of aggregate functions in earlier 
cases. Can you please link to those cases, to make sure that we are not 
reversing an earlier decision. 


was (Author: julianhyde):
I’m not sure that this is a bug. Yes, exceptions are tiresome. But what 
behavior would be better? Changing the type derivation is also problematic. 

> 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
>            Assignee: xiong duan
>            Priority: Major
>              Labels: pull-request-available
>
>  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)

Reply via email to