aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min_Opt.yql
blob: 2f6803c9ce7e7a9f15f56681efe2efff5ba9a5cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# program
(
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))

(import agg_module '"/lib/yql/aggregate.yql")
(let list (AsList
(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2))))
(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3))))
(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4))))
(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32)))))
(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32)))))
(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32)))))
))
(let min_traits (Apply (bind agg_module 'min_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v)))
(let res_sink (DataSink 'result))
(let resKey (Aggregate list '('key) '('('min_value min_traits 'value))))
(let world (Write! world res_sink (Key) resKey '('('type))))
(let world (Commit! world res_sink))
(return world)
)