aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/InMem/GroupOpt.yql
blob: 30fcbac0b5b179093d1eca1b5576108bd30f6830 (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
(
#comment
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))

(let res_sink (DataSink 'result))
(let list (AsList
'((Just (Uint32 '2)) (Just (String 'D)))
'((Nothing (OptionalType (DataType 'Uint32))) (Just (String 'E)))
'((Just (Uint32 '3)) (Just (String 'A)))
'((Just (Uint32 '3)) (Nothing (OptionalType (DataType 'String))))
'((Just (Uint32 '2)) (Just (String 'B)))
'((Just (Uint32 '3)) (Just (String 'A)))
))

(let keyExtractor (lambda '(x) (Nth x '0)))
(let handler (lambda '(key list) (Just '(key list))))
(let data (GroupByKey list keyExtractor handler))

(let world (Write! world res_sink (Key) data '()))
(let world (Commit! world res_sink))
(return world)
)