aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/produce/process_multi_out.sql
blob: a6162a13a8eeb6b1bcdc68d4af06ee3cec830393 (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
/* syntax version 1 */
/* postgres can not */
$udfScript = @@
def MyFunc(list):
    return [(int(x.key) % 2, x) for x in list]
@@;

$record = (SELECT TableRow() FROM plato.Input);
$recordType =TypeOf(Unwrap($record));

$udf = Python::MyFunc(
    CallableType(0,
        StreamType(
            VariantType(TupleType($recordType, $recordType))
        ),
        StreamType($recordType)),
    $udfScript
);

$i, $j = (PROCESS plato.Input USING $udf(TableRows()));

select * from $i;

select * from $j;