blob: 32ab9bdf8edb41f1ce3a1619d64d76039f207101 (
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
24
25
26
27
28
|
# 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 '0)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '1))))
(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Bool)))))
(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1))))
(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool)))))
(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1))))
(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1))))
(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0))))
(AsStruct '('key (Uint32 '5)) '('value (Nothing (OptionalType (DataType 'Bool)))))
))
(let or_traits (Apply (bind agg_module 'or_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value))))
(let res_sink (DataSink 'result))
(let resKey (Aggregate list '('key) '('('or_value or_traits))))
(let world (Write! world res_sink (Key) resKey '('('type))))
(let world (Commit! world res_sink))
(return world)
)
|