aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/optimizers/yql-7324_duplicate_arg.sql
blob: df26751a74562ad7bfe83e823748916a2ce1c17b (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
/* postgres can not */
/* syntax version 1 */
USE plato;

$to_int = ($x) -> { return cast($x as Int32) };
$to_in_list = ($col) -> { return ListMap(String::SplitToList($col, ","), $to_int) };

$input = (
    SELECT
        $to_in_list(key) AS event_ids,
        $to_in_list(subkey) AS test_ids
    FROM
        Input
    WHERE
        value = "aaa"
);

SELECT
    event_id,
    test_ids
FROM
    $input
FLATTEN BY event_ids AS event_id;