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

Mihai Budiu commented on CALCITE-6427:
--------------------------------------

There are also aggregates like var_pop, which return a result which is much 
larger than the input type. With the current typing rules of Calcite, these may 
overflow.

> Use a higher precision for DECIMAL intermediate results for some aggregate 
> functions like STDDEV
> ------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6427
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6427
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>
> Today aggregates like STDDEV are expanded into computations that use 
> intermediate results with the same type as the input values. Since STDDEV 
> squares values, this precision may prove insufficient. For DECIMAL values a 
> reasonable approach would be to use double the input precision and scale.
> This is also related to [CALCITE-6322], [CALCITE-4924], [CALCITE-6324]



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

Reply via email to