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 "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/06/26 01:11:00 UTC

[jira] [Resolved] (IMPALA-7020) Order by expressions in Analytical functions are not materialized causing slowdown

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

Tim Armstrong resolved IMPALA-7020.
-----------------------------------
    Fix Version/s: Impala 4.0
       Resolution: Fixed

> Order by expressions in Analytical functions are not materialized causing slowdown
> ----------------------------------------------------------------------------------
>
>                 Key: IMPALA-7020
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7020
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 2.12.0
>            Reporter: Mostafa Mokhtar
>            Assignee: Tim Armstrong
>            Priority: Major
>              Labels: performance
>             Fix For: Impala 4.0
>
>         Attachments: Slow case profile.txt, Workaround profile.txt
>
>
> Order by expressions in Analytical functions are not materialized and cause queries to run much slower.
> The rewrite for the query below is 20x faster, profiles attached.
> Repro 
> {code}
> select *
> FROM
>   (
>     SELECT
>       o.*,
>       ROW_NUMBER() OVER(ORDER BY evt_ts DESC) AS rn
>     FROM
>       (
>         SELECT
>           l_orderkey,l_partkey,l_linenumber,l_quantity, cast (l_shipdate as string) evt_ts
>         FROM
>           lineitem
>         WHERE
>           l_shipdate  BETWEEN '1992-01-01 00:00:00' AND '1992-01-15 00:00:00'
>       ) o
>   ) r
> WHERE
>   rn BETWEEN 1 AND 101
> ORDER BY rn;
> {code}
> Workaround 
> {code}
> select *
> FROM
>   (
>     SELECT
>       o.*,
>       ROW_NUMBER() OVER(ORDER BY evt_ts DESC) AS rn
>     FROM
>       (
>         SELECT
>           l_orderkey,l_partkey,l_linenumber,l_quantity, cast (l_shipdate as string) evt_ts
>         FROM
>           lineitem
>         WHERE
>           l_shipdate  BETWEEN '1992-01-01 00:00:00' AND '1992-01-15 00:00:00'
>           union all 
>                   SELECT
>           l_orderkey,l_partkey,l_linenumber,l_quantity, cast (l_shipdate as string) evt_ts
>         FROM
>           lineitem limit 0
>         
>       ) o
>   ) r
> WHERE
>   rn BETWEEN 1 AND 101
> ORDER BY rn;
> {code}



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