Maksim Zhuravkov created IGNITE-20009:
-----------------------------------------

             Summary: 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


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). 




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

Reply via email to