summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/win_range_int_max2.yql
blob: e6cf2b0e8ab2a2deb654f5aefbd6182da57cc974 (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;

$uint64_max = uint64('18446744073709551615');

$data = [
    <|a: $uint64_max, count: 4|>,
    <|a: $uint64_max, count: 4|>,
    <|a: 0, count: 4|>,
    <|a: 0, count: 4|>,
];

$win_result = (
    SELECT
        COUNT(*) OVER w1 AS actual_count,
        count,
    FROM
        AS_TABLE($data)
    WINDOW
        w1 AS (
            ORDER BY
                a ASC
            RANGE BETWEEN $uint64_max PRECEDING AND $uint64_max 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
;