You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2021/10/30 05:25:00 UTC

[jira] [Updated] (PHOENIX-6507) DistinctAggregatingResultIterator should keep original tuple order of the AggregatingResultIterator

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

Istvan Toth updated PHOENIX-6507:
---------------------------------
    Fix Version/s: 5.1.3

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