summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/win_range_int_float_inf.yql
blob: ba64a98e4eb44b385af85c3f412d2f061ae25778 (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
30
31
32
33
34
PRAGMA WindowNewPipeline;
/* custom error: Inf is not allowed for RANGE frame bounds */

$data = [
    <|a: 1, count: 5|>,
    <|a: 2, count: 5|>,
    <|a: 3, count: 5|>,
    <|a: 5, count: 5|>,
    <|a: 6, count: 5|>,
];

$win_result = (
    SELECT
        COUNT(*) OVER w1 AS actual_count,
        count,
    FROM
        AS_TABLE($data)
    WINDOW
        w1 AS (
            ORDER BY
                a ASC
            RANGE BETWEEN Float("inf") PRECEDING AND Double("inf") FOLLOWING
        )
);

$str = ($x) -> {
    return CAST($x as String) ?? "null";
};

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