summaryrefslogtreecommitdiffstats
path: root/yt/yql/tests/sql/suites/produce/reduce_lambda_list_table.yql
blob: 39aa5ec294d67f74b987a02c7e57e29d64bbe40e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* postgres can not */
USE plato;

$udf = YQL::@@(lambda '(key stream) (AsStruct
  '('key key) '('summ (Collect (Condense stream (Uint32 '0) (lambda '(item state) (Bool 'False)) (lambda '(item state) (Add state item)))))
))@@;

--INSERT INTO Output
$res = (REDUCE (select AsList(key) as key, value from Input1) ON key USING $udf(cast(value as uint32) ?? 0));

select * from $res order by key;