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

Maryann Xue commented on PHOENIX-944:
-------------------------------------

The ClientGroupedAggregatingResultIterator composes of two aggregating logic 
here, one is the server agg and the other client agg. It seems reasonable that 
we have one inner iterator doing the server agg, and one client iterator doing 
the client part. But GroupedAggregatingResultIterator is now NOT capable of 
being either without any changes, for the reason that:
1. for server agg, group-key is not the current row-key; plus, we need to 
return a MultiKeyValueTuple instance instead of SingleKeyValueTuple in order to 
avoid this being mistaken for re-aggregation.
2. for client agg, since it encloses the server agg iterator, it contradicts 
with the GroupedAggregatingResultIterator's assumption that the inner iterator 
is a PeekingResultIterator.

So I suggest first remove that assumption (the code would become a little more 
complicated and would look more like the current 
ClientGroupedAggregatingResultIterator in the patch), and second add some 
abstraction to the current GroupedAggregatingResultIterator.

> Support derived tables in FROM clause that needs extra steps of client-side 
> aggregation or other processing
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-944
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-944
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 4.0.0, 5.0.0
>            Reporter: Maryann Xue
>            Assignee: Maryann Xue
>             Fix For: 3.0.0, 4.0.0, 5.0.0
>
>         Attachments: 944.patch
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Groupby in both outer and inner queries cannot be flattened. We can apply an 
> extra step of client-side aggregation to handle such cases.
> See DerivedTableIT.java for all those examples that are currently not 
> supported.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to