aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/EquiJoin/FlattenLeftSemi.yqls
blob: 2b3166643e1598db2b24683a6f67bff0938ebbb5 (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
(
(let mr_source (DataSource 'yt 'plato))
(let x (Read! world mr_source (Key '('table (String 'Input1))) '('key 'subkey 'value) '()))
(let world (Left! x))
(let table1 (Right! x))
(let table1 (Map table1 (lambda '(item) (AsStruct
  '('key (Just (Member item 'key)))
  '('subkey1 (Just (Member item 'subkey)))
  '('value1 (Just (Member item 'value)))))))

(let x (Read! world mr_source (Key '('table (String 'Input2))) '('key 'subkey 'value) '()))
(let world (Left! x))
(let table2 (Right! x))

(let table2 (Map table2 (lambda '(item) (AsStruct
  '('key (Just (Member item 'key)))
  '('subkey2 (Just (Member item 'subkey)))
  '('value2 (Just (Member item 'value)))))))

(let join (EquiJoin '(table1 'a) '(table2 'b)
    '('LeftSemi '"a" '"b" '('"a" '"key") '('"b" '"key" ) '()) 
    '('('flatten))))

(let res_sink (DataSink 'result))
(let sortDir '((Bool 'true) (Bool 'true)))
(let keySelector (lambda '(row) '((Member row '"key") (Member row '"subkey1"))))
(let world (Write! world res_sink (Key) (Sort join sortDir keySelector) '('('type))))
(let world (Commit! world res_sink))
(return world)
)