aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/flatten_by/flatten_with_resource.sql
blob: 8dda0726f4b0e7cf6e465b6c996007f21c7776b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* postgres can not */
/* kikimr can not */
/* syntax version 1 */
$script = @@
def save(item):
    return item

def load(item):
    return item
@@;

$save = Python3::save(Callable<(String)->Resource<Python3>>, $script);
$load = Python3::load(Callable<(Resource<Python3>)->String>, $script);

$input = (
    SELECT key, AsList($save(value), $save(subkey)) AS resourceList FROM plato.Input
);

SELECT key, $load(resourceList) AS value FROM $input FLATTEN BY resourceList;