blob: 71d61c2a0ce754ef67f740ad425b4770fa4e1d1a (
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
|
(
#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 mrtc (Right! (Read! world mr_source (Key '('table (String 'Input))) (Void) '('('inline)))))
(let mrtc (FlatMap mrtc (lambda '(item) (block '(
(let value (Member item 'value))
(return (ListIf (< value (String 'qqq)) item))
)))))
(let filter (ToDict mrtc (lambda '(x) (Member x 'value)) (lambda '(x) (Member x 'subkey)) '('Hashed 'One 'Compact)))
(let keySelector (lambda '(x) (Member x 'key)))
(let listHandler (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
(let key (Nth pair '0))
(let list (ForwardList (Nth pair '1)))
(let r (FlatMap list (lambda '(item) (block '(
(return (ListIf (Contains filter (Member item 'value)) item))
)))))
(return (FlatListIf (< key (String '500)) r))
))))))
(let out (PartitionByKey table1 keySelector (Void) (Void) listHandler))
(let out (Sort out (Bool 'true) (lambda '(x) (Member x 'key))))
(let mr_sink (DataSink 'yt 'plato))
(let world (Write! world mr_sink (Key '('table (String 'Output))) out '('('mode 'append))))
(let world (Commit! world mr_sink))
(return world)
)
|