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

Haisheng Yuan commented on CALCITE-4008:
----------------------------------------

Sorry to replying late.
Let's focus on simple aggregate, disable it for Grouping Sets, Ordered-set 
aggregate, filtered aggregate, distinct or approximate aggregate, aggregate 
without group keys.

The sort aggregate requires the input tuples are already sorted by group keys.
1. If we don't already have the first tuple of the new group, fetch it from the 
input node.
2. Keep the first input tuple; we will use this for comparison.
3. Process each input-node tuple, and then fetch the next one, until we exhaust 
the input node or cross a group boundary.
4. For each tuple, iterate all the aggregate calls, execute them sequentially.

Let me know if you have further questions. :)

> Implement Code generation for EnumerableSortedAggregate
> -------------------------------------------------------
>
>                 Key: CALCITE-4008
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4008
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Haisheng Yuan
>            Assignee: Rui Wang
>            Priority: Minor
>
> EnumerableSortedAggregate is added in 1.23.0, but doesn't implement code 
> generation. It would be nice if we can add code generation for it, so that 
> more efficient plan can be generated and used for some queries, e.g.
> {code:java}
> select foo.a, max(b) from
>    foo join bar on foo.a=bar.a 
>    group by a order by a desc;
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to