aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/produce/reduce_with_assume.sql
blob: 3f51be0d124eee16e303c0fda231b392375d7d91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* postgres can not */
/* multirun can not */
/* syntax version 1 */
USE plato;

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

INSERT INTO Output
REDUCE Input ON key USING $udf(cast(subkey as uint32) ?? 0) ASSUME ORDER BY key;