You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Aman Sinha (Jira)" <ji...@apache.org> on 2020/07/22 07:15:00 UTC

[jira] [Work started] (IMPALA-9983) Push limit from a top level sort onto analytic sort when applicable

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

Work on IMPALA-9983 started by Aman Sinha.
------------------------------------------
> Push limit from a top level sort onto analytic sort when applicable
> -------------------------------------------------------------------
>
>                 Key: IMPALA-9983
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9983
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 3.4.0
>            Reporter: Aman Sinha
>            Assignee: Aman Sinha
>            Priority: Major
>
> For queries of the following type:
> {noformat}
> select * from (select l_partkey, l_quantity, 
>               rank() over (partition by l_partkey order by l_quantity desc) rk 
>    from lineitem) dt 
>    where rk <= 100
>    group by l_partkey, l_quantity
>    order by l_partkey, l_quantity, rk
>    limit 100
> {noformat}
> the limit 100 from the outer order by can be pushed down to the analytic sort that is done below the AnalyticEval operator.  The reason is there are effectively 2 limits:
>   PARTITION BY l_partkey ORDER BY l_quantity LIMIT PER PARTITION 100
>   ORDER BY l_partkey .... LIMIT 100
> and together they imply
> ORDER BY l_partkey, l_quantity  LIMIT 100
> For the limit pushdown to work, the partition-by exprs must be a leading prefix of the order-by exprs. Also, other qualifying conditions must be met based on the above pattern.
>     



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org