diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/s-expressions/suites/Lib | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/s-expressions/suites/Lib')
57 files changed, 1246 insertions, 0 deletions
diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg.yql new file mode 100644 index 0000000000..3a918b3c81 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '7))) +)) +(let avg_traits (Apply (bind agg_module 'avg_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('avg_value avg_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If.yql new file mode 100755 index 0000000000..3b90e99391 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If.yql @@ -0,0 +1,22 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Uint32 '17))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('pred (Bool '0)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Uint32 '9))) +)) +(let avg_traits (Apply (bind agg_module 'avg_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'pred)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('avg_value avg_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If_Opt.yql new file mode 100755 index 0000000000..830f163e5f --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_If_Opt.yql @@ -0,0 +1,22 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('pred (Bool '0)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Just (Uint32 '9)))) +)) +(let avg_traits (Apply (bind agg_module 'avg_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'pred)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('avg_value avg_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +)
\ No newline at end of file diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_Opt.yql new file mode 100644 index 0000000000..1862c9703d --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Avg_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '9)))) +)) +(let avg_traits (Apply (bind agg_module 'avg_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('avg_value avg_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_And.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_And.yql new file mode 100644 index 0000000000..75cbff2731 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_And.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let and_traits (Apply (bind agg_module 'bit_and_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('and_value and_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Or.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Or.yql new file mode 100644 index 0000000000..37cd22a4ed --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Or.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let or_traits (Apply (bind agg_module 'bit_or_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('or_value or_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Xor.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Xor.yql new file mode 100644 index 0000000000..b4cb8e8f5a --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bit_Xor.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let xor_traits (Apply (bind agg_module 'bit_xor_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('xor_value xor_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_And_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_And_Opt.yql new file mode 100644 index 0000000000..3f57941811 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_And_Opt.yql @@ -0,0 +1,28 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '5)) '('value (Nothing (OptionalType (DataType 'Bool))))) +)) +(let and_traits (Apply (bind agg_module 'and_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('and_value and_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Or_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Or_Opt.yql new file mode 100644 index 0000000000..32ab9bdf8e --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Or_Opt.yql @@ -0,0 +1,28 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '5)) '('value (Nothing (OptionalType (DataType 'Bool))))) +)) +(let or_traits (Apply (bind agg_module 'or_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('or_value or_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Xor_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Xor_Opt.yql new file mode 100644 index 0000000000..7463add10f --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Bool_Xor_Opt.yql @@ -0,0 +1,28 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '4)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '5)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '5)) '('value (Nothing (OptionalType (DataType 'Bool))))) +)) +(let xor_traits (Apply (bind agg_module 'xor_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('xor_value xor_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Compare_By_Opts.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Compare_By_Opts.yql new file mode 100644 index 0000000000..f00b6365aa --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Compare_By_Opts.yql @@ -0,0 +1,24 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Just (Uint32 '7))) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Just (Uint32 '2))) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Just (Uint32 '1))) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Just (Uint32 '3))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Just (Uint32 '2))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Just (Uint32 '6))) '('value (Just (Uint32 '6)))) +(AsStruct '('key (Just (Uint32 '5))) '('value (Just (Uint32 '9)))) +)) +(let min (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void))) +(let max (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('min min) '('max max)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count.yql new file mode 100644 index 0000000000..70c1586820 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let count_traits (Apply (bind agg_module 'count_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All.yql new file mode 100644 index 0000000000..4e21b049d6 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let count_traits (Apply (bind agg_module 'count_all_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All_Opt.yql new file mode 100644 index 0000000000..2bbd4d8aee --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_All_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let count_traits (Apply (bind agg_module 'count_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If.yql new file mode 100644 index 0000000000..05fc3411ee --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Bool '0))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '1))) +(AsStruct '('key (Uint32 '1)) '('value (Bool '0))) +(AsStruct '('key (Uint32 '3)) '('value (Bool '1))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '1))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '0))) +)) +(let count_traits (Apply (bind agg_module 'count_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If_Opt.yql new file mode 100644 index 0000000000..562b296e54 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_If_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +)) +(let count_traits (Apply (bind agg_module 'count_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_Opt.yql new file mode 100644 index 0000000000..1c622b7dc4 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Count_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let count_traits (Apply (bind agg_module 'count_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count.yql new file mode 100644 index 0000000000..4164df0baf --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let count_traits (Apply (bind agg_module 'count_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All.yql new file mode 100644 index 0000000000..f0aa559269 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let count_traits (Apply (bind agg_module 'count_all_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All_Opt.yql new file mode 100644 index 0000000000..35b9f5ff52 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_All_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let count_traits (Apply (bind agg_module 'count_all_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If.yql new file mode 100644 index 0000000000..2f803d033c --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Bool '0))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '1))) +(AsStruct '('key (Uint32 '1)) '('value (Bool '0))) +(AsStruct '('key (Uint32 '3)) '('value (Bool '1))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '0))) +(AsStruct '('key (Uint32 '2)) '('value (Bool '1))) +)) +(let count_traits (Apply (bind agg_module 'count_if_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If_Opt.yql new file mode 100644 index 0000000000..23fc8348fd --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_If_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Bool '0)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Bool))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Bool '1)))) +)) +(let count_traits (Apply (bind agg_module 'count_if_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_Opt.yql new file mode 100644 index 0000000000..b8d6f537a6 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Count_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let count_traits (Apply (bind agg_module 'count_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('count_value count_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max.yql new file mode 100644 index 0000000000..5ecf5b1435 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let max_traits (Apply (bind agg_module 'max_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('max_value max_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max_Opt.yql new file mode 100644 index 0000000000..9eeab95381 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Max_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let max_traits (Apply (bind agg_module 'max_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('max_value max_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min.yql new file mode 100644 index 0000000000..b31163c9ed --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let min_traits (Apply (bind agg_module 'min_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('min_value min_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min_Opt.yql new file mode 100644 index 0000000000..2f6803c9ce --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Min_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let min_traits (Apply (bind agg_module 'min_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('min_value min_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some.yql new file mode 100644 index 0000000000..f765ed07b9 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '0))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '1))) +)) +(let some_traits (Apply (bind agg_module 'some_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('some_value some_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some_Opt.yql new file mode 100644 index 0000000000..7194f87bdc --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Some_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '1)))) +)) +(let some_traits (Apply (bind agg_module 'some_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('some_value some_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum.yql new file mode 100644 index 0000000000..6aaa8a231a --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let sum_traits (Apply (bind agg_module 'sum_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum_Opt.yql new file mode 100644 index 0000000000..4c19ad9f29 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Distinct_Sum_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let sum_traits (Apply (bind agg_module 'sum_traits_factory) (ListType (StructMemberType (ListItemType (TypeOf list)) 'value)) (lambda '(v) v))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits 'value)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List.yql new file mode 100644 index 0000000000..61ed0f2179 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '7))) +)) +(let list_traits (Apply (bind agg_module 'list_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (Uint64 '0))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('list_value list_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Compare_By_Opts.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Compare_By_Opts.yql new file mode 100644 index 0000000000..6fc7177662 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Compare_By_Opts.yql @@ -0,0 +1,29 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Just (Uint32 '7))) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Just (Uint32 '7))) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Just (Uint32 '2))) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Just (Uint32 '1))) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Just (Uint32 '0))) '('value (Just (Uint32 '9)))) +(AsStruct '('key (Just (Uint32 '1))) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Just (Uint32 '1))) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Just (Uint32 '3))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Just (Uint32 '2))) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Just (Uint32 '6))) '('value (Just (Uint32 '6)))) +(AsStruct '('key (Just (Uint32 '5))) '('value (Just (Uint32 '9)))) +(AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (Just (Uint32 '9)))) +)) +(let min (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Uint64 '3))) +(let max (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Uint64 '3))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('min min) '('max max)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Limit.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Limit.yql new file mode 100644 index 0000000000..ab1302c752 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Limit.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '7))) +)) +(let list_traits (Apply (bind agg_module 'list_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (Uint64 '1))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('list_value list_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By.yql new file mode 100644 index 0000000000..0572dfb448 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By.yql @@ -0,0 +1,23 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '7))) +)) +(let traits (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'key)) (lambda '(row) (Member row 'value)) (Uint64 '3))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By_Opt.yql new file mode 100644 index 0000000000..d2ec207c91 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Max_By_Opt.yql @@ -0,0 +1,22 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '9)))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Uint32 '9)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let traits (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Uint64 '3))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By.yql new file mode 100644 index 0000000000..e29fb2715c --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By.yql @@ -0,0 +1,23 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '8))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '8))) +)) +(let traits (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'key)) (lambda '(row) (Member row 'value)) (Uint64 '7))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By_Opt.yql new file mode 100644 index 0000000000..96e85e97c4 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Min_By_Opt.yql @@ -0,0 +1,23 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '7)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '9)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let traits (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Uint64 '3))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Opt.yql new file mode 100644 index 0000000000..a22f743db3 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_List_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '9)))) +)) +(let list_traits (Apply (bind agg_module 'list_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (Uint64 '0))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('list_value list_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max.yql new file mode 100644 index 0000000000..8bf97f958c --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let max_traits (Apply (bind agg_module 'max_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('max_value max_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By.yql new file mode 100644 index 0000000000..e28d35900c --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let traits (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'key)) (lambda '(row) (Member row 'value)) (Void))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By_Opt.yql new file mode 100644 index 0000000000..95168e3143 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_By_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '0)) '('value (Just (Uint32 '9)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let traits (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_Opt.yql new file mode 100644 index 0000000000..6e41241625 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Max_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let max_traits (Apply (bind agg_module 'max_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('max_value max_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min.yql new file mode 100644 index 0000000000..35ecccd09e --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let min_traits (Apply (bind agg_module 'min_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('min_value min_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By.yql new file mode 100644 index 0000000000..3ad67c8e7f --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '0)) '('value (Uint32 '7))) +)) +(let traits (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'key)) (lambda '(row) (Member row 'value)) (Void))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By_Opt.yql new file mode 100644 index 0000000000..7e48591609 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_By_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '7)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let traits (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '() '('('result traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_Opt.yql new file mode 100644 index 0000000000..648369b4d3 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Min_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '2)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +)) +(let min_traits (Apply (bind agg_module 'min_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('min_value min_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some.yql new file mode 100644 index 0000000000..629a3cea33 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '9))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '8))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let some_traits (Apply (bind agg_module 'some_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('some_value some_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some_Opt.yql new file mode 100644 index 0000000000..34ec224a58 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Some_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '7)))) +)) +(let some_traits (Apply (bind agg_module 'some_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('some_value some_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum.yql new file mode 100644 index 0000000000..2a943f1234 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('value (Uint32 '10))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '2)) '('value (Uint32 '5))) +)) +(let sum_traits (Apply (bind agg_module 'sum_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If.yql new file mode 100755 index 0000000000..c229026827 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If.yql @@ -0,0 +1,22 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Uint32 '5))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Uint32 '17))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Uint32 '2))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Uint32 '4))) +(AsStruct '('key (Uint32 '3)) '('pred (Bool '0)) '('value (Uint32 '1))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Uint32 '3))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Uint32 '9))) +)) +(let sum_traits (Apply (bind agg_module 'sum_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'pred)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If_Opt.yql new file mode 100755 index 0000000000..51e667e8d3 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_If_Opt.yql @@ -0,0 +1,22 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('pred (Bool '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('pred (Bool '0)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '0)) '('value (Just (Uint32 '3)))) +(AsStruct '('key (Uint32 '2)) '('pred (Bool '1)) '('value (Just (Uint32 '9)))) +)) +(let sum_traits (Apply (bind agg_module 'sum_if_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'pred)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +)
\ No newline at end of file diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_Opt.yql b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_Opt.yql new file mode 100644 index 0000000000..a50b4f93a9 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Agg_Sum_Opt.yql @@ -0,0 +1,21 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import agg_module '"/lib/yql/aggregate.yql") +(let list (AsList +(AsStruct '('key (Uint32 '1)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '1)) '('value (Just (Uint32 '4)))) +(AsStruct '('key (Uint32 '3)) '('value (Nothing (OptionalType (DataType 'Uint32))))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +(AsStruct '('key (Uint32 '2)) '('value (Just (Uint32 '5)))) +)) +(let sum_traits (Apply (bind agg_module 'sum_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)))) +(let res_sink (DataSink 'result)) +(let resKey (Aggregate list '('key) '('('sum_value sum_traits)))) +(let world (Write! world res_sink (Key) resKey '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Decode.sql b/yql/essentials/tests/s-expressions/suites/Lib/Decode.sql new file mode 100644 index 0000000000..d56651c52b --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Decode.sql @@ -0,0 +1,4 @@ +SELECT Core::Decode("key1",AsList("key1","value1","key2","value2"),"default"); +SELECT Core::Decode("key2",AsList("key1","value1","key2","value2"),"default"); +SELECT Core::Decode("keyZ",AsList("key1","value1","key2","value2"),"default"); + diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Decode.yql b/yql/essentials/tests/s-expressions/suites/Lib/Decode.yql new file mode 100644 index 0000000000..25d3e102c6 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Decode.yql @@ -0,0 +1,72 @@ +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import aggregate_module '"/lib/yql/aggregate.yql") +(import window_module '"/lib/yql/window.yql") +(import core_module '"/lib/yql/core.yql") +(let world (block '( + (let output (block '( + (let select (block '( + (let core (AsList (Uint32 '0))) + (let core (FlatMap core (lambda '(row) (block '( + (let res (AsStruct '('"column0" ("Apply" ("bind" core_module '"Decode") (String '"key1") ("AsList" (String '"key1") (String '"value1") (String '"key2") (String '"value2")) (String '"default"))))) + (let res (AsList res)) + (return res) + ))))) + (return core) + ))) + (return select) + ))) + (let world (block '( + (let result_sink (DataSink 'result)) + (let world (Write! world result_sink (Key) output '('('type) '('autoref) '('columns '('"column0"))))) + (return (Commit! world result_sink)) + ))) + (return world) +))) +(let world (block '( + (let output (block '( + (let select (block '( + (let core (AsList (Uint32 '0))) + (let core (FlatMap core (lambda '(row) (block '( + (let res (AsStruct '('"column0" ("Apply" ("bind" core_module '"Decode") (String '"key2") ("AsList" (String '"key1") (String '"value1") (String '"key2") (String '"value2")) (String '"default"))))) + (let res (AsList res)) + (return res) + ))))) + (return core) + ))) + (return select) + ))) + (let world (block '( + (let result_sink (DataSink 'result)) + (let world (Write! world result_sink (Key) output '('('type) '('autoref) '('columns '('"column0"))))) + (return (Commit! world result_sink)) + ))) + (return world) +))) +(let world (block '( + (let output (block '( + (let select (block '( + (let core (AsList (Uint32 '0))) + (let core (FlatMap core (lambda '(row) (block '( + (let res (AsStruct '('"column0" ("Apply" ("bind" core_module '"Decode") (String '"keyZ") ("AsList" (String '"key1") (String '"value1") (String '"key2") (String '"value2")) (String '"default"))))) + (let res (AsList res)) + (return res) + ))))) + (return core) + ))) + (return select) + ))) + (let world (block '( + (let result_sink (DataSink 'result)) + (let world (Write! world result_sink (Key) output '('('type) '('autoref) '('columns '('"column0"))))) + (return (Commit! world result_sink)) + ))) + (return world) +))) +(let world (block '( + (return world) +))) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/Sqr.yql b/yql/essentials/tests/s-expressions/suites/Lib/Sqr.yql new file mode 100644 index 0000000000..431c462e10 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/Sqr.yql @@ -0,0 +1,12 @@ +# program +( +(let config (DataSource 'config)) +(let world (Configure! world config 'PureDataSource 'yt)) + +(import sqr_module '"/lib/yql/sqr.yql") +(let mySqr (bind sqr_module 'sqr)) +(let res_sink (DataSink 'result)) +(let world (Write! world res_sink (Key) (Apply mySqr (Uint32 '4)) '('('type)))) +(let world (Commit! world res_sink)) +(return world) +) diff --git a/yql/essentials/tests/s-expressions/suites/Lib/default.cfg b/yql/essentials/tests/s-expressions/suites/Lib/default.cfg new file mode 100644 index 0000000000..e41deb15c5 --- /dev/null +++ b/yql/essentials/tests/s-expressions/suites/Lib/default.cfg @@ -0,0 +1,2 @@ +res result.txt +mount ..\mounts.txt |