aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Optimizers/Top.yql
blob: e0a2bab0366fc68037c6d9f3cf648c206e234508 (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
(
#comment
(let mr_source (DataSource 'yt 'plato))
(let res_sink (DataSink 'result))

(let x (Read! world mr_source (Key '('table (String 'Input))) (Void) '()))
(let world (Left! x))
(let table (Right! x))

(let list (AsList
    (AsStruct '('a (Uint32 '4)) '('b (String 'c)))
    (AsStruct '('a (Uint32 '1)) '('b (String 'd)))
    (AsStruct '('a (Uint32 '3)) '('b (String 'b)))
))

# Top->Take
(let world (Write! world res_sink (Key) (Top table (Uint64 '3) '() (lambda '(item) '())) '('('type))))
(let world (Write! world res_sink (Key) (TopSort table (Uint64 '3) '() (lambda '(item) '())) '('('type))))

# tuple with single item
(let world (Write! world res_sink (Key) (Top table (Uint64 '3) '((Bool 'True)) (lambda '(item) '((Member item 'key)))) '('('type))))
(let world (Write! world res_sink (Key) (TopSort table (Uint64 '3) '((Bool 'True)) (lambda '(item) '((Member item 'key)))) '('('type))))

# zero count
(let world (Write! world res_sink (Key) (Top table (Uint64 '0) (Bool 'True) (lambda '(item) (Member item 'key))) '('('type))))
(let world (Write! world res_sink (Key) (TopSort table (Uint64 '0) (Bool 'True) (lambda '(item) (Member item 'key))) '('('type))))
(let world (Write! world res_sink (Key) (Collect (Top (Iterator table (DependsOn (String 'a))) (Uint64 '0) (Bool 'True) (lambda '(item) (Member item 'key)))) '('('type))))
(let world (Write! world res_sink (Key) (Collect (TopSort (Iterator table (DependsOn (String 'b))) (Uint64 '0) (Bool 'True) (lambda '(item) (Member item 'key)))) '('('type))))

# list <= N
(let world (Write! world res_sink (Key) (Top list (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'a))) '('('type))))
(let world (Write! world res_sink (Key) (TopSort list (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'a))) '('('type))))

# ExtractMembers
(let world (Write! world res_sink (Key) (ExtractMembers (Top table (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'key))) '('key 'value)) '('('type))))
(let world (Write! world res_sink (Key) (ExtractMembers (TopSort table (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'key))) '('key 'value)) '('('type))))
(let world (Write! world res_sink (Key) (ExtractMembers (Top table (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'key))) '('value)) '('('type))))
(let world (Write! world res_sink (Key) (ExtractMembers (TopSort table (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'key))) '('value)) '('('type))))

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