aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/select/use_subrequest_as_table.sqlx
blob: a5227e7e2ec15e17f5c99cb2490a6e4d1923efaa (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 */
$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;