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

(let res_sink (DataSink 'result))
(let data (AsList (String 'a) (String 'a) (String 'b)))
(let preMap (lambda '(item) (Just item)))
(let keyExtractor (lambda '(item) item))
(let init (lambda '(key item) item))
(let update (lambda '(key item state) (Concat state item)))
(let finish (lambda '(key state) (AsList '(key state))))
(let combined (CombineByKey data preMap keyExtractor init update finish))
(let map (Map combined (lambda '(x) (Nth x '1))))
(let result (Sort map (Bool 'true) (lambda '(x) x)))
(let world (Write! world res_sink (Key) result '()))
(let world (Commit! world res_sink))
(return world)
)