aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Optimizers/SkipTakeOverMrTableContentInsideMap.yqls
blob: 5bfc63445ee38780e52df88e740ca2d8e53cd3ae (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
(
    #comment
    (let mr_source (DataSource 'yt 'plato))
    (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
    (let world (Left! x))
    (let table1 (Right! x))

    (let r (Read! world mr_source (Key '('table (String 'Input))) (Void) '('('inline))))
    (let mrtc (Right! r))
    (let mrtc (Skip mrtc (Uint64 '5)))
    (let mrtc (Take mrtc (Uint64 '3)))
    (let mrtc (FlatMap mrtc (lambda '(item) (block '(
           (let key (Member item 'key))
           (return (ListIf (> key (String '100)) item))
    )))))
    (let filter (ToDict mrtc (lambda '(x) (Member x 'key)) (lambda '(x) (Member x 'value)) '('Hashed 'One)))

    (let tresh (String '500))
    (let out (FlatMap table1 (lambda '(item) (block '(
           (let key (Member item 'key))
           (return (ListIf (And (< key tresh) (Contains filter key)) item))
    )))))
    (let mr_sink (DataSink 'yt 'plato))
    (let world (Write! world mr_sink (Key '('table (String 'Output))) out '('('mode 'append))))
    (let world (Commit! world mr_sink))
    (return world)
)