aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/rank/unordered.sql
blob: c8213f505e5ac253e040f70ada780557cb0e3af8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* syntax version 1 */
/* postgres can not */

PRAGMA warning("disable", "4520");
PRAGMA warning("disable", "4521");
PRAGMA AnsiRankForNullableKeys;

SELECT
    key,
    subkey,
    RANK()                              over w1 as r1,
    DENSE_RANK()                        over w1 as r2,

    RANK()                              over w2 as r3,
    DENSE_RANK()                        over w2 as r4,
FROM plato.Input
WINDOW
    w1 as (PARTITION BY key ROWS BETWEEN UNBOUNDED PRECEDING AND 5 PRECEDING),
    w2 as (                 ROWS BETWEEN 3 FOLLOWING AND 2 FOLLOWING)
ORDER BY key,subkey;