aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/MultiIO/LMapWithMultiIn.yql
blob: 261a85c9317c8c3ed29dc14aeef4d6cb89fd7631 (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
(
#comment
(let mr_source (DataSource 'yt 'plato))
(let mr_sink (DataSink 'yt 'plato))

(let x (Read! world mr_source (Key '('table (String 'Input1))) (Void) '()))
(let world (Left! x))
(let data1 (Right! x))

(let x (Read! world mr_source (Key '('table (String 'Input2))) (Void) '()))
(let world (Left! x))
(let data2 (Right! x))

(let data (Mux '(data1 data2)))

(let data (LMap data (lambda '(stream) (block '(
    (return (FlatMap stream (lambda '(item) (block '(
        (let res (Visit item
            '0 (lambda '(item) (block '(
                (let s (Struct))
                (let s (AddMember s 'key (Member item 'key)))
                (let s (AddMember s 'subkey (String '0)))
                (let s (AddMember s 'value (Member item 'value)))
                (return s)
            )))
            '1 (lambda '(item) (block '(
                (let s (Struct))
                (let s (AddMember s 'key (Member item 'key)))
                (let s (AddMember s 'subkey (String '1)))
                (let s (AddMember s 'value (Member item 'value)))
                (return s)
            )))
        ))
        (return (Just res))
    )))))
)))))

(let world (Write! world mr_sink (Key '('table (String 'Output1))) data '('('mode 'renew))))

(let world (Commit! world mr_sink))
(return world)
)