aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/produce/process_row_and_columns.sql
blob: 8ce580f61530b8286b21043cc55cd3ad046703e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* syntax version 1 */
/* postgres can not */
$udfScript = @@
def processRow(row, tag, separator):
	return {"value":row.Name + separator + row.Value + separator + tag};
@@;

$udf = Python::processRow(
    Callable<(Struct<Name:String, Tag:String, Value:String>, String, String)->Struct<value:String>>,
    $udfScript
);

$data = (
    SELECT key AS Name, value AS Value, subkey AS Tag FROM plato.Input0
);

$separator = "|";

PROCESS $data USING $udf(TableRow(), Tag, $separator);