aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Optimizers/FuseLMapAfterReduce.sql
blob: f0bd1ff3ba0d160764072015bfd633e877f47d4b (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
USE plato;

$a = (SELECT
    skey,count(*) as cnt
FROM Input
GROUP BY Length(key) as skey);

$udfScript = @@
def f(input,x):
   for i in list(input):
      d = i.__dict__
      d["pass"] = x
      yield d
@@;

$udf = Python::f(@@
(Stream<Struct<skey:Uint32,cnt:Uint64>>,Int32)
->
Stream<Struct<skey:Uint32,cnt:Uint64,pass:Int32>>
@@, $udfScript);


PROCESS $a USING $udf($ROWS,1);