aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Optimizers/UnionOfSortedDesc.yqls
blob: b1de8fceb14da7a1332c8e3e0ccb464810fbfc01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(
(let source (DataSource 'yt 'plato))
(let sink (DataSink 'yt 'plato))

(let r (Read! world source (MrTableConcat (Key '('table (String '"Input")))) (Void) '()))
(let input (Right! r))
(let world (Left! r))

(let mapLambda (lambda '(item) (AsList (AsStruct '('"key" (Member item '"key"))))))
(let keyExtractLambda  (lambda '(item) (Member item '"key")))

(let out1 (Sort (FlatMap input mapLambda) (Bool 'false) keyExtractLambda))
(let out2 (Sort (FlatMap input mapLambda) (Bool 'false) keyExtractLambda))
(let union (UnionAll (Take out1 (Int32 '"3")) (Take out2 (Int32 '"2"))))

(let world (Write! world sink (Key '('table (String '"Output"))) union '('('mode 'renew))))
(let world (Commit! world sink))

(return world)
)