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

Konstantin Orlov updated IGNITE-23023:
--------------------------------------
    Fix Version/s: 3.0

> Sql. Improve result type for AVG function for NUMERIC types
> -----------------------------------------------------------
>
>                 Key: IGNITE-23023
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23023
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Iurii Gerzhedovich
>            Assignee: Konstantin Orlov
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> After implementing IGNITE-22988 we should have the type of return value for 
> AVG function the same as the argument for the function. This is in line with 
> the SQL 2016 standard, but at the same time, the standard allows scale bigger 
> than the input argument and most databases use extended scale.
> {code:java}
> iii)  If AVG is specified and DT is exact numeric, then the declared type of 
> the result is an implementation-defined exact numeric type with precision not 
> less than the precision of DT and scale not less than the scale of DT.
> iv)  If DT is approximate numeric, then the declared type of the result is an 
> implementation-defined approximate numeric type with precision not less than 
> the precision of DT.
> v)  If DT is decimal floating-point, then the declared type of the result is 
> the decimal floating-point type with implementation-defined precision not 
> less than the precision of DT.{code}
> Let's extend precision with the following rules:
> ||Input type||Result type||Minimum scale||
> |any exact numeric types:
> DECIMAL, BIGINT, INTEGER, SMALLINT, TINYINT|DECIMAL|16|
> |any approximate numeric types:
> DOUBLE, REAL|DOUBLE| |
>  
>  
>  



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

Reply via email to