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

Istvan Toth commented on PHOENIX-6507:
--------------------------------------

Backported to 5.1 branch.

> DistinctAggregatingResultIterator should keep original tuple order of the 
> AggregatingResultIterator
> ---------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6507
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6507
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.16.1, 5.1.2
>            Reporter: chenglei
>            Assignee: chenglei
>            Priority: Major
>             Fix For: 4.17.0, 5.2.0, 5.1.3
>
>         Attachments: PHOENIX-6507_v2-4.x.patch, PHOENIX-6507_v2-master.patch
>
>
> Given following tables :
> {code:java}
>    create table test ( 
>       pk1 varchar not null , 
>       pk2 varchar not null, 
>       pk3 varchar not null,
>        v1 varchar, 
>        v2 varchar, 
>       CONSTRAINT TEST_PK PRIMARY KEY ( pk1,pk2,pk3))
> {code}
> The result of the following sql may be incorrect:
> {code:java}
>    select distinct pk1,max(v1) from test group by pk1,pk2,pk3 order by pk1
> {code}
> The problem is the {{order by}} is complied out because it is the prefix of 
> the {{group by}}, but for {{distinct}},  
> {{DistinctAggregatingResultIterator}} using {{HashSet}} to rearrange the 
> aggregated tuples.



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

Reply via email to