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

Maksim Zhuravkov updated IGNITE-20009:
--------------------------------------
    Description: 
Map/reduce implementation of some aggregates requires replacing an aggregate 
with a combination of aggregates. For example AVG(col) should be implemented as 
:
MAP: SUM(col)  sum_col, COUNT (col) as count_col
REDUCE: SUM(sum_col)/SUM(COUNT(count_col))

To implement this we need the following changes:
- Replace AVG on MAP phase with SUM and COUNT. 
- Change rowType produced by MAP phase/accepted by REDUCE phase.
- Add a projection after reduce aggregate that includes division and produces 
final result (it obviously should include other aggregation results as well in 
the correct order). 


  was:
Map/reduce implementation of some aggregates requires replacing an aggregate 
with a combination of aggregates. For example AVG(x) should be implemented as :
MAP: SUM(x)  sum_x, COUNT (x) as count_x
REDUCE: SUM(sum_x)/SUM(COUNT(count_x))

To implement this we need the following changes:
- Replace AVG on MAP phase with SUM and COUNT. 
- Change rowType produced by MAP phase/accepted by REDUCE phase.
- Add a projection after reduce aggregate that includes division and produces 
final result (it obviously should include other aggregation results as well in 
the correct order). 



> Sql. Rework 2-phase aggregates part 2. AVG as SUM / COUNT.
> ----------------------------------------------------------
>
>                 Key: IGNITE-20009
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20009
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 3.0.0-beta1
>            Reporter: Maksim Zhuravkov
>            Priority: Minor
>              Labels: ignite-3
>
> Map/reduce implementation of some aggregates requires replacing an aggregate 
> with a combination of aggregates. For example AVG(col) should be implemented 
> as :
> MAP: SUM(col)  sum_col, COUNT (col) as count_col
> REDUCE: SUM(sum_col)/SUM(COUNT(count_col))
> To implement this we need the following changes:
> - Replace AVG on MAP phase with SUM and COUNT. 
> - Change rowType produced by MAP phase/accepted by REDUCE phase.
> - Add a projection after reduce aggregate that includes division and produces 
> final result (it obviously should include other aggregation results as well 
> in the correct order). 



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

Reply via email to