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

chenglei updated PHOENIX-4690:
------------------------------
    Affects Version/s: 4.13.2

> GroupBy expressions should follow the order of PK Columns if GroupBy is 
> orderPreserving
> ---------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4690
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4690
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.13.2
>            Reporter: chenglei
>            Priority: Critical
>
> Given a table :
> {code}
>  create table test ( 
>        pk1 integer not null , 
>        pk2 integer not null, 
>        v integer, 
>        CONSTRAINT TEST_PK PRIMARY KEY (pk1,pk2))
> {code}
> and some data:
> {code}
> +------+------+-----+
> | PK1  | PK2  |  V  |
> +------+------+-----+
> | 1    | 8    | 10  |
> | 1    | 9    | 11  |
> | 2    | 3    | 13  |
> | 2    | 7    | 15  |
> | 3    | 2    | 17  |
> +------+------+-----+
> {code}
> for following sql :
> {code}
>     select pk2,pk1,count(v) from test group by pk2,pk1 order by pk2,pk1
> {code}
> the expected result is :
> {code}
> +------+------+-----------+
> | PK2  | PK1  | COUNT(V)  |
> +------+------+-----------+
> | 2    | 3    | 1         |
> | 3    | 2    | 1         |
> | 7    | 2    | 1         |
> | 8    | 1    | 1         |
> | 9    | 1    | 1         |
> +------+------+-----------+
> {code}
> but the actual result is :
> {code}
> +------+------+-----------+
> | PK2  | PK1  | COUNT(V)  |
> +------+------+-----------+
> | 8    | 1    | 1         |
> | 9    | 1    | 1         |
> | 3    | 2    | 1         |
> | 7    | 2    | 1         |
> | 2    | 3    | 1         |
> +------+------+-----------+
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to