You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2024/09/06 11:34:00 UTC

[jira] [Updated] (IGNITE-23023) Sql. Improve result type for AVG function for NUMERIC types

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

Konstantin Orlov updated IGNITE-23023:
--------------------------------------
    Summary: Sql. Improve result type for AVG function for NUMERIC types  (was: SQL. Improve result type for AVG function for NUMERIC types.)

> 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
>            Priority: Major
>              Labels: ignite-3
>
> 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)