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

Julian Hyde edited comment on CALCITE-5181 at 6/6/22 8:01 PM:
--------------------------------------------------------------

[~libenchao], I agree that we should split into two parts. We need to decide 
the type, and when we have decided the type, we need to define an implement the 
overflow behavior.

The rules for inferring the type have been discussed in other issues. (Please 
link, if you have them.)

In this particular jira case I think we should focus on overflow behavior. If 
you agree, change the subject accordingly.


was (Author: julianhyde):
[~libenchao], I agree that we should split into two parts. We need to decide 
the type, and when we have decided the type, we need to define an implement the 
overflow behavior.

The rules for inferring the type have been discussed in other issues. (Please 
link, if you have them.)

In this particular jira case I think we should focus on overflow behavior.

> SUM aggregate function return wong result
> -----------------------------------------
>
>                 Key: CALCITE-5181
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5181
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.30.0
>            Reporter: xiong duan
>            Priority: Major
>
> To reproduce(dummy.iq):
> {code:java}
> !use scott
> !set outputformat mysql
> SELECT sum(empno) from "scott".emp; {code}
> Should return 108172, but return -22900.
> This is because RelDataTypeSystemImpl deriveSumType return a wrong datatype. 
> We presume when the parameter is smllInt, the return datatype stay same as 
> the parameter. So the result out of range.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to