aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-12-13 15:14:50 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-12-13 16:07:36 +0300
commit5cbdc6f2bc811da3e6104da774a30b25a54a8708 (patch)
tree68f3ddb0d928332e5ea73853f40f4670f4babb65 /yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls
parent1402a032649d20ffb80a541f706afcd31cd897fa (diff)
downloadydb-5cbdc6f2bc811da3e6104da774a30b25a54a8708.tar.gz
Intermediate changes
commit_hash:27af5f8a0a7836d78ffdc205213f07f79dd9f7ad
Diffstat (limited to 'yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls')
-rw-r--r--yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls50
1 files changed, 50 insertions, 0 deletions
diff --git a/yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls b/yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls
new file mode 100644
index 0000000000..3fa0a24d9b
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/View/DsvCount.yqls
@@ -0,0 +1,50 @@
+(
+(let x (Read! world (DataSource 'yt 'plato) (Key '('table (String 'Input))) '('dict) '()))
+(let world (Left! x))
+(let Input (Right! x))
+(let select1_input11 Input)
+(let output12 (block '(
+ (let select1_output select1_input11)
+ (let select1_output (Filter select1_output (lambda '(row) (block '(
+ (let res (Coalesce (!= (Not (Exists (Lookup (Member row 'dict) (String '"c")))) (Bool 'true)) (Bool 'false)))
+ (return res)
+)
+))))
+ (let select1_output (PartitionByKey select1_output (lambda '(row) (block '(
+ (let res (String '""))
+ (return res)
+)
+)) (Void) (Void) (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let group (ForwardList (Nth pair '1)))
+ (let aggr (Fold1 group (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'Count7 (Convert (Exists (Unwrap (Lookup (Member row 'dict) (String '"a")))) 'Uint64)))
+ (return res)
+)
+)) (lambda '(row state) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'Count7 (OptionalReduce (Member state 'Count7) (Convert (Exists (Unwrap (Lookup (Member row 'dict) (String '"a")))) 'Uint64) (lambda '(a b) (+ a b)))))
+ (return res)
+)
+))))
+ (let res (FlatMap aggr (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'a_count (Member row 'Count7)))
+ (let res (AsList res))
+ (return res)
+)
+))))
+ (return res)
+)))))
+))
+ (return select1_output)
+)
+))
+(let result_sink (DataSink 'result))
+(let world (Write! world result_sink (Key) output12 '('('type) '('autoref) '('columns '('a_count)))))
+(let plato_sink (DataSink 'yt 'plato))
+(let world (Commit! world plato_sink))
+(let world (Commit! world result_sink))
+(return world)
+)