aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/sampling/reduce.sql
blob: 0f72b6438010aa085503e04a9e01d2b0bed7de0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* postgres can not */
/* custom check: len(yt_res_yson[0]['Write'][0]['Data']) < 8 */
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)))))
))@@;

$res = (REDUCE Input TABLESAMPLE BERNOULLI(30) REPEATABLE(1) ON key USING $udf(cast(value as uint32) ?? 0));

select * from $res order by key;