aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/SingleYamrOperation/TableInsertCastList.yqls
blob: ce2f6fa8eb5c2029231e37063cd0ee2c04542618 (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
43
44
45
46
47
48
49
50
51
52
53
(
(let world (block '(
  (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key") '()))
  (let world (Left! x))
  (let table0 (Right! x))
  (let values (block '(
    (let select (block '(
      (let core table0)
      (let core (Filter core (lambda '(row) (Coalesce ("<" (Member row '"key") (String '"100")) (Bool 'false)))))
      (let core (FlatMap core (lambda '(row) (block '(
        (let res (Struct))
        (let res (AddMember res '"value" (MatchType (Member row '"key") 'Optional (lambda '(item) (Coalesce (Map item (lambda '(val) (IfType val (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Just (Convert item '"Int64")))))) (Nothing (OptionalType (DataType '"Int64"))))) (lambda '(item) (IfType item (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Convert item '"Int64")))))))
        (let res (AsList res))
        (return res)
      )))))
      (return core)
    )))
    (return select)
  )))
  (let world (block '(
    (let sink (DataSink '"yt" '"plato"))
    (let world (Write! world sink (Key '('table (String '"Output"))) values '('('mode 'append))))
    (return (Commit! world sink))
  )))
  (return world)
)))
(let world (block '(
  (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key") '()))
  (let world (Left! x))
  (let table0 (Right! x))
  (let values (block '(
    (let select (block '(
      (let core table0)
      (let core (Filter core (lambda '(row) (Coalesce (">=" (Member row '"key") (String '"100")) (Bool 'false)))))
      (let core (FlatMap core (lambda '(row) (block '(
        (let res (Struct))
        (let res (AddMember res '"value" (Int64 '"1")))
        (let res (AsList res))
        (return res)
      )))))
      (return core)
    )))
    (return select)
  )))
  (let world (block '(
    (let sink (DataSink '"yt" '"plato"))
    (let world (Write! world sink (Key '('table (String '"Output"))) values '('('mode 'append))))
    (return (Commit! world sink))
  )))
  (return world)
)))
(return world)
)