aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Scheme/FieldNames.yqls
blob: ab951ab11bc1f3f240faecc87c5d5f1e4e44e336 (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
(
# read data from Input table
(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))

# filter keys less than 100
(let tresh (Int32 '100))
(let table1low (Map table1 (lambda '(item) (block '(
   (let val (Struct))
   (let val (AddMember val 'foo (Member item 'key)))   
   (let val (AddMember val 'bar (Member item 'value)))   
   (let ret (Struct))
   (let ret (AddMember ret 'key (Member item 'value)))
   (let ret (AddMember ret 'subkey (String '"")))
   (let ret (AddMember ret 'value val))
   (return ret)
)))))

# write table1low to result sink
(let res_sink (DataSink 'result))
(let world (Write! world res_sink
    (Key)
    table1low '()))

# finish
(let world (Commit! world res_sink))
(return world)
)