summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/range_pg/win_range_int_double.yql
blob: 3067ee7fae2dbe072a5b6a4d18ed75e139d81e36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
PRAGMA WindowNewPipeline;

$data = [
    <|a: pgfloat4('1.5'), count: 2|>,
    <|a: pgfloat4('2.0'), count: 3|>,
    <|a: pgfloat4('2.8'), count: 3|>,
    <|a: pgfloat4('5.0'), count: 2|>,
    <|a: pgfloat4('6.0'), count: 2|>,
];

$win_result = (
    SELECT
        COUNT(*) OVER w1 AS actual_count,
        count,
    FROM
        AS_TABLE($data)
    WINDOW
        w1 AS (
            ORDER BY
                a ASC
            RANGE BETWEEN pgfloat8('1.5') PRECEDING AND pgfloat8('1') FOLLOWING
        )
);

SELECT
    Ensure(actual_count, count IS NOT DISTINCT FROM actual_count)
FROM
    $win_result
;