summaryrefslogtreecommitdiffstats
path: root/yt/yql/tests/sql/suites/produce/reduce_with_python_input_stream.yql
blob: 68bf6c7d72ac379690165c82e3819344c93ff9ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* custom error: Cannot execute ScriptUdf over stream/flow inside DQ stage */
USE plato;

$udfScript = @@
import functools
def Len(key, input):
    return {"value":functools.reduce(lambda x,y: x + 1, input, 0)}
@@;

$udf = Python::Len(Callable<(String, Stream<String>)->Struct<value:Uint32>>, $udfScript);

$res = (REDUCE Input1 ON key USING $udf(value));

select * from $res order by value;