aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Udf/Sleep.yql
blob: 86d036c80ff48d9dea9dbf1546b36d26262c91f5 (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
(
(let sleep (Udf 'SimpleUdf.Sleep))
(let 01sec (Uint64 '100000))
(let 05sec (Uint64 '500000))
(let 03sec (Uint64 '300000))

#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 table1map (Map table1 (lambda '(item) (block '(
   (let data1 (Apply sleep (+ 05sec 01sec)))
   (let s (Struct))
   (let s (AddMember s 'key (Member item 'key)))
   (let s (AddMember s 'subkey (String  '1)))
   (let s (AddMember s 'value (ToString data1)))
   (return s)
)))))
(let table2map (Map table1 (lambda '(item) (block '(
   (let data1 (Apply sleep (+ 03sec 03sec)))
   (let s (Struct))
   (let s (AddMember s 'key (Member item 'key)))
   (let s (AddMember s 'subkey (String  '2)))
   (let s (AddMember s 'value (ToString data1)))
   (return s)
)))))
(let mr_sink (DataSink 'yt 'plato))
(let res_sink (DataSink 'result))
(let world (Write! world mr_sink (Key '('table (String 'Output))) table1map '()))
(let world (Write! world res_sink (Key) table2map '()))
(let world (Commit! world mr_sink))
(let world (Commit! world res_sink))
(return world)
)