summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/select/use_subrequest_as_table.yql
blob: b0debd33c3b2b6bf71a1147708a424363e785e58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$script = @@
def test(src):
    l = []
    for i in src:
        l.append(str(i.test))
        l.append(str(i.test2))
    return str(l)
@@;

$test_table_1 =
    (
    SELECT 1 AS test, "a" AS test2
    UNION ALL
    SELECT 2 AS test, "b" AS test2
    );

$callable = Python::test(Callable<(List<Struct<test:Int32,test2:String?>>) -> String?>, $script);

SELECT
    $callable( $test_table_1 ) -- use as const subrequest should contain one column
FROM $test_table_1;