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

chenglei updated PHOENIX-4820:
------------------------------
    Description: 
Given a table
{code}
  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}

for following sql :
{code}
     select a.ak3 
     from (select substr(pk1,1,1) ak1,substr(pk2,1,1) ak2,substr(pk3,1,1) 
ak3,substr(v1,1,1) av1,substr(v2,1,1) av2 from test order by pk2,pk3 limit 10) 
a  group by a.ak3,a.av1 order by a.ak3,a.av1
{code}

Intuitively, the above OrderBy statement should be compiled out, but in fact it 
is not.

  was:
Given a table
{code}
  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}

for following sql :
{code}
     select a.ak3 
     from (select substr(pk1,1,1) ak1,substr(pk2,1,1) ak2,substr(pk3,1,1) 
ak3,substr(v1,1,1) av1,substr(v2,1,1) av2 from test 
              order by pk2,pk3 limit 10) a 
     group by a.ak3,a.av1 order by a.ak3,a.av1
{code}

Intuitively, the above OrderBy statement should be compiled out, but 


> Optimize OrderBy for ClientAggregatePlan
> ----------------------------------------
>
>                 Key: PHOENIX-4820
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4820
>             Project: Phoenix
>          Issue Type: Improvement
>    Affects Versions: 4.14.0
>            Reporter: chenglei
>            Priority: Major
>
> Given a table
> {code}
>   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}
> for following sql :
> {code}
>      select a.ak3 
>      from (select substr(pk1,1,1) ak1,substr(pk2,1,1) ak2,substr(pk3,1,1) 
> ak3,substr(v1,1,1) av1,substr(v2,1,1) av2 from test order by pk2,pk3 limit 
> 10) a  group by a.ak3,a.av1 order by a.ak3,a.av1
> {code}
> Intuitively, the above OrderBy statement should be compiled out, but in fact 
> it is not.



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

Reply via email to