blob: ff322d1a1ecc1391a7025fabcdb4c784922b7d2d (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#program
(
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))
(import agg_module '"/lib/yql/aggregate.yql")
(let list (AsList
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '1))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '4))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '1)) '('value (Just (Int32 '1))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '2))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '2))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '2))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '2)) '('value (Just (Int32 '1))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '1))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '2))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '3))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '4))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '5))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '6))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '7))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '8))))
(AsStruct '('key (Int32 '3)) '('value (Just (Int32 '9))))
))
(let res_sink (DataSink 'result))
(let topfreq_traits (Apply (bind agg_module 'topfreq_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (Uint32 '2) (Uint32 '2)))
(let resKey (Aggregate list '('key) '('('topfreq_value topfreq_traits))))
(let world (Write! world res_sink (Key) resKey '('('type))))
(let topfreq_traits2 (Apply (bind agg_module 'topfreq_traits_factory) (TypeOf list) (lambda '(row) (Unwrap (ToString (Member row 'value)))) (Uint32 '2) (Uint32 '2)))
(let resKey (Aggregate list '('key) '('('topfreq_value topfreq_traits2))))
(let world (Write! world res_sink (Key) resKey '('('type))))
(let world (Commit! world res_sink))
(return world)
)
|