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/sql/suites/agg_phases | |
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/sql/suites/agg_phases')
25 files changed, 1922 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/agg_phases/avg.sql b/yql/essentials/tests/sql/suites/agg_phases/avg.sql new file mode 100644 index 0000000000..c4ee64fe05 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/avg.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,avg(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/avg_null.sql b/yql/essentials/tests/sql/suites/agg_phases/avg_null.sql new file mode 100644 index 0000000000..5399da509a --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/avg_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,avg(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/avg_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/avg_opt.sql new file mode 100644 index 0000000000..4d65617197 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/avg_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,avg(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,avg(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,avg(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count.sql b/yql/essentials/tests/sql/suites/agg_phases/count.sql new file mode 100644 index 0000000000..56ebee9864 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count_all.sql b/yql/essentials/tests/sql/suites/agg_phases/count_all.sql new file mode 100644 index 0000000000..b84047ec4d --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count_all.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count_all_null.sql b/yql/essentials/tests/sql/suites/agg_phases/count_all_null.sql new file mode 100644 index 0000000000..d66d1d3690 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count_all_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count_all_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/count_all_opt.sql new file mode 100644 index 0000000000..cd818df3fd --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count_all_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(*) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count_null.sql b/yql/essentials/tests/sql/suites/agg_phases/count_null.sql new file mode 100644 index 0000000000..428e6b1e9b --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/count_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/count_opt.sql new file mode 100644 index 0000000000..97df3a4e5a --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/count_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,count(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,count(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,count(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/default.cfg b/yql/essentials/tests/sql/suites/agg_phases/default.cfg new file mode 100644 index 0000000000..800d911a03 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/default.cfg @@ -0,0 +1,2 @@ +udf stat_udf +udf set_udf
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/agg_phases/max.sql b/yql/essentials/tests/sql/suites/agg_phases/max.sql new file mode 100644 index 0000000000..bc80374fa6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/max.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,max(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/max_null.sql b/yql/essentials/tests/sql/suites/agg_phases/max_null.sql new file mode 100644 index 0000000000..381d745ab5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/max_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,max(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/max_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/max_opt.sql new file mode 100644 index 0000000000..00976d77bf --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/max_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,max(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,max(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,max(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min.sql b/yql/essentials/tests/sql/suites/agg_phases/min.sql new file mode 100644 index 0000000000..3b10505ebf --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min_by.sql b/yql/essentials/tests/sql/suites/agg_phases/min_by.sql new file mode 100644 index 0000000000..ad1fbc54c4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min_by.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min_by(a,a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min_by_null.sql b/yql/essentials/tests/sql/suites/agg_phases/min_by_null.sql new file mode 100644 index 0000000000..d6b2cac34b --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min_by_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min_by(a,a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min_by_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/min_by_opt.sql new file mode 100644 index 0000000000..6382a1bee9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min_by_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min_by(a,a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min_by(a,a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min_by(value,value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min_null.sql b/yql/essentials/tests/sql/suites/agg_phases/min_null.sql new file mode 100644 index 0000000000..3e2185e44f --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/min_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/min_opt.sql new file mode 100644 index 0000000000..268c0d3347 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/min_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,min(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,min(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,min(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/percentile.sql b/yql/essentials/tests/sql/suites/agg_phases/percentile.sql new file mode 100644 index 0000000000..2ef5c32855 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/percentile.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,percentile(a, 0.1) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/percentile_null.sql b/yql/essentials/tests/sql/suites/agg_phases/percentile_null.sql new file mode 100644 index 0000000000..6a94334f4f --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/percentile_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,percentile(a, 0.1) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/percentile_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/percentile_opt.sql new file mode 100644 index 0000000000..fd7dd6e529 --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/percentile_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,percentile(a, 0.1) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,percentile(a, 0.1) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,percentile(value, 0.1) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/sum.sql b/yql/essentials/tests/sql/suites/agg_phases/sum.sql new file mode 100644 index 0000000000..5d9f78108c --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/sum.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: 2|>,<|key: 1, value: 3|>]); + +$p = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,sum(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/sum_null.sql b/yql/essentials/tests/sql/suites/agg_phases/sum_null.sql new file mode 100644 index 0000000000..d20e645c5b --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/sum_null.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: null|>,<|key: 1, value: null|>]); + +$p = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,sum(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + diff --git a/yql/essentials/tests/sql/suites/agg_phases/sum_opt.sql b/yql/essentials/tests/sql/suites/agg_phases/sum_opt.sql new file mode 100644 index 0000000000..2759e2c08c --- /dev/null +++ b/yql/essentials/tests/sql/suites/agg_phases/sum_opt.sql @@ -0,0 +1,80 @@ +/* syntax version 1 */ +/* postgres can not */ + +$t = SELECT * FROM AS_TABLE([<|key: 1, value: just(2)|>,<|key: 1, value: just(3)|>]); + +$p = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with combine + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with combinestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + +$p = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergestate + ; + +$p = PROCESS $p; +--select FormatType(TypeOf($p)); +select * from $p; + + +$p1 = SELECT + key,sum(a) as a +FROM $p +GROUP BY + key + with mergefinalize + ; + +$p1 = PROCESS $p1; +--select FormatType(TypeOf($p1)); +select * from $p1; + +$p2 = SELECT + key,sum(a) as a +FROM (select key, just(a) as a from $p) +GROUP BY + key + with mergemanyfinalize + ; + +$p2 = PROCESS $p2; +--select FormatType(TypeOf($p2)); +select * from $p2; + +$p3 = +SELECT + key,sum(value) as a +FROM $t +GROUP BY + key + with finalize + ; + +$p3 = PROCESS $p3; +--select FormatType(TypeOf($p)); +select * from $p3; + |