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/count | |
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/count')
29 files changed, 110 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/count/avg_and_sum_by_value.txt b/yql/essentials/tests/sql/suites/count/avg_and_sum_by_value.txt new file mode 100644 index 0000000000..cebd64e139 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/avg_and_sum_by_value.txt @@ -0,0 +1,4 @@ +{"key"="1";"subkey"="10";"value"="FOO"}; +{"key"="2";"subkey"="20";"value"="BAR"}; +{"key"="3";"subkey"="30";"value"="BAR"}; +{"key"="WAT";"subkey"="WAT";"value"="FOO"}; diff --git a/yql/essentials/tests/sql/suites/count/boolean_count.cfg b/yql/essentials/tests/sql/suites/count/boolean_count.cfg new file mode 100644 index 0000000000..28975418d4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/boolean_count.cfg @@ -0,0 +1 @@ +in Input count_input.txt diff --git a/yql/essentials/tests/sql/suites/count/boolean_count.sql b/yql/essentials/tests/sql/suites/count/boolean_count.sql new file mode 100644 index 0000000000..8ecebf2391 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/boolean_count.sql @@ -0,0 +1,3 @@ +select count(*) from plato.Input; +select count(e) from plato.Input; +select count(distinct e) from plato.Input; diff --git a/yql/essentials/tests/sql/suites/count/count.cfg b/yql/essentials/tests/sql/suites/count/count.cfg new file mode 100644 index 0000000000..28975418d4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count.cfg @@ -0,0 +1 @@ +in Input count_input.txt diff --git a/yql/essentials/tests/sql/suites/count/count.sql b/yql/essentials/tests/sql/suites/count/count.sql new file mode 100644 index 0000000000..9c01b87439 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count.sql @@ -0,0 +1,6 @@ +/* syntax version 1 */ +select a, aggregate_list(b), count(*) from plato.Input group by a order by a; +select b, aggregate_list(a), count(*) from plato.Input group by b order by b; +select c, aggregate_list(a), count(*) from plato.Input group by c order by c; +select d, aggregate_list(a), count(*) from plato.Input group by d order by d; +select e, aggregate_list(a), count(*) from plato.Input group by e order by e; diff --git a/yql/essentials/tests/sql/suites/count/count_all.sql b/yql/essentials/tests/sql/suites/count/count_all.sql new file mode 100644 index 0000000000..1e638449b7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all.sql @@ -0,0 +1 @@ +select count(*) from plato.Input;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/count_all_grouped-empty.cfg b/yql/essentials/tests/sql/suites/count/count_all_grouped-empty.cfg new file mode 100644 index 0000000000..3bccc051db --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all_grouped-empty.cfg @@ -0,0 +1 @@ +in Input empty.txt diff --git a/yql/essentials/tests/sql/suites/count/count_all_grouped.cfg b/yql/essentials/tests/sql/suites/count/count_all_grouped.cfg new file mode 100644 index 0000000000..58878f8945 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all_grouped.cfg @@ -0,0 +1 @@ +in Input input.txt diff --git a/yql/essentials/tests/sql/suites/count/count_all_grouped.sql b/yql/essentials/tests/sql/suites/count/count_all_grouped.sql new file mode 100644 index 0000000000..234ad3625a --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all_grouped.sql @@ -0,0 +1 @@ +select key, count(*) from plato.Input group by key order by key;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/count_all_view_concat.cfg b/yql/essentials/tests/sql/suites/count/count_all_view_concat.cfg new file mode 100644 index 0000000000..8b7633b301 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all_view_concat.cfg @@ -0,0 +1 @@ +in Input view_input.txt diff --git a/yql/essentials/tests/sql/suites/count/count_all_view_concat.sql b/yql/essentials/tests/sql/suites/count/count_all_view_concat.sql new file mode 100644 index 0000000000..1dba44bcdd --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_all_view_concat.sql @@ -0,0 +1,3 @@ +/* postgres can not */ +/* syntax version 1 */ +select count(*) as count from plato.concat(Input view ksv, Input view ksv); diff --git a/yql/essentials/tests/sql/suites/count/count_by_nulls.cfg b/yql/essentials/tests/sql/suites/count/count_by_nulls.cfg new file mode 100644 index 0000000000..1af92ac7be --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_by_nulls.cfg @@ -0,0 +1 @@ +in Input input_intersect_with_holes.txt diff --git a/yql/essentials/tests/sql/suites/count/count_by_nulls.sql b/yql/essentials/tests/sql/suites/count/count_by_nulls.sql new file mode 100644 index 0000000000..6265a21122 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_by_nulls.sql @@ -0,0 +1 @@ +select count(cast(subkey as int)) as not_null_subkeys from plato.Input; diff --git a/yql/essentials/tests/sql/suites/count/count_const_no_grouping.sql b/yql/essentials/tests/sql/suites/count/count_const_no_grouping.sql new file mode 100644 index 0000000000..0590d2c282 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_const_no_grouping.sql @@ -0,0 +1 @@ +select count(1) from plato.Input;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.cfg b/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.cfg new file mode 100644 index 0000000000..8b7633b301 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.cfg @@ -0,0 +1 @@ +in Input view_input.txt diff --git a/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.sql b/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.sql new file mode 100644 index 0000000000..d45d8742ad --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_distinct_from_view_concat.sql @@ -0,0 +1,3 @@ +/* postgres can not */ +/* syntax version 1 */ +select count(distinct k) as count from plato.concat(Input view ksv, Input view ksv); diff --git a/yql/essentials/tests/sql/suites/count/count_input.txt b/yql/essentials/tests/sql/suites/count/count_input.txt new file mode 100644 index 0000000000..851703e9a0 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_input.txt @@ -0,0 +1,5 @@ +{"a"=1;"b"=1u;"c"=0.1;"d"="x";"e"=%false;"f"={"a"="b";"c"="d";"e"=[0;1;2]}}; +{"a"=2;"b"=2u;"c"=2.5;"d"="xx";"e"=%true;"f"=0.123}; +{"a"=-5;"b"=8u;"c"=10.;"d"="xxx";"f"="xyz"}; +{"b"=5u;"d"="skdjfnsdf";"e"=%false}; +{}; diff --git a/yql/essentials/tests/sql/suites/count/count_input.txt.attr b/yql/essentials/tests/sql/suites/count/count_input.txt.attr new file mode 100644 index 0000000000..3176be619e --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_input.txt.attr @@ -0,0 +1,3 @@ +{ + "_read_schema"=[{"type"="int64";"name"="a"};{"type"="uint64";"name"="b"};{"type"="double";"name"="c"};{"type"="string";"name"="d"};{"type"="boolean";name="e"};{"type"="any";"name"="f"}] +} diff --git a/yql/essentials/tests/sql/suites/count/count_no_grouping.sql b/yql/essentials/tests/sql/suites/count/count_no_grouping.sql new file mode 100644 index 0000000000..7b0b662f41 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_no_grouping.sql @@ -0,0 +1 @@ +select count(value) from plato.Input;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/count_nullable.cfg b/yql/essentials/tests/sql/suites/count/count_nullable.cfg new file mode 100644 index 0000000000..8153a1f3e5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_nullable.cfg @@ -0,0 +1 @@ +in Input avg_and_sum_by_value.txt diff --git a/yql/essentials/tests/sql/suites/count/count_nullable.sql b/yql/essentials/tests/sql/suites/count/count_nullable.sql new file mode 100644 index 0000000000..4b70423490 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_nullable.sql @@ -0,0 +1 @@ +select count(cast(key as int)), value from plato.Input group by value order by value;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/count_nullable_sub.sql b/yql/essentials/tests/sql/suites/count/count_nullable_sub.sql new file mode 100644 index 0000000000..0f962a7138 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/count_nullable_sub.sql @@ -0,0 +1,8 @@ +select + count(val) as subkey, + cast(avg(val) as int) as value, + value as key +from + (select case key when '0' then NULL else cast(subkey as int) / cast(key as int) end as val, value from plato.Input2) as res +group by value +order by value;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/count/default.cfg b/yql/essentials/tests/sql/suites/count/default.cfg new file mode 100644 index 0000000000..8d2f379d10 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/default.cfg @@ -0,0 +1,2 @@ +in Input input.txt +in Input2 input2.txt diff --git a/yql/essentials/tests/sql/suites/count/empty.txt b/yql/essentials/tests/sql/suites/count/empty.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/empty.txt @@ -0,0 +1 @@ + diff --git a/yql/essentials/tests/sql/suites/count/input.txt b/yql/essentials/tests/sql/suites/count/input.txt new file mode 100644 index 0000000000..65949ea745 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/input.txt @@ -0,0 +1,4 @@ +{"key"="075";"subkey"="1";"value"="abc"}; +{"key"="800";"subkey"="2";"value"="ddd"}; +{"key"="020";"subkey"="3";"value"="q"}; +{"key"="150";"subkey"="4";"value"="qzz"}; diff --git a/yql/essentials/tests/sql/suites/count/input2.txt b/yql/essentials/tests/sql/suites/count/input2.txt new file mode 100644 index 0000000000..5c939cf453 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/input2.txt @@ -0,0 +1,4 @@ +{"key"="1";"subkey"="10";"value"="FOO"}; +{"key"="1";"subkey"="20";"value"="BAR"}; +{"key"="1";"subkey"="30";"value"="BAR"}; +{"key"="0";"subkey"="40";"value"="FOO"}; diff --git a/yql/essentials/tests/sql/suites/count/input_intersect_with_holes.txt b/yql/essentials/tests/sql/suites/count/input_intersect_with_holes.txt new file mode 100644 index 0000000000..e010220a24 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/input_intersect_with_holes.txt @@ -0,0 +1,14 @@ +{"key"="075";"subkey"="null";"value"="abc"}; +{"key"="911";"subkey"="1";"value"="kkk"}; +{"key"="023";"subkey"="null";"value"="aaa"}; +{"key"="527";"subkey"="023";"value"="bbb"}; +{"key"="037";"subkey"="075";"value"="ddd"}; +{"key"="761";"subkey"="911";"value"="ccc"}; +{"key"="200";"subkey"="322";"value"="qqq"}; +{"key"="150";"subkey"="null";"value"="zzz"}; +{"key"="023";"subkey"="null";"value"="vca"}; +{"key"="527";"subkey"="null";"value"="oef"}; +{"key"="037";"subkey"="761";"value"="vdf"}; +{"key"="761";"subkey"="null";"value"="aet"}; +{"key"="200";"subkey"="150";"value"="fdb"}; +{"key"="150";"subkey"="null";"value"="bfs"}; diff --git a/yql/essentials/tests/sql/suites/count/view_input.txt b/yql/essentials/tests/sql/suites/count/view_input.txt new file mode 100644 index 0000000000..df76c64125 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/view_input.txt @@ -0,0 +1,4 @@ +{"key"="075";"subkey"="1";"value"="a7c"}; +{"key"="800";"subkey"="2";"value"="ddd"}; +{"key"="020";"subkey"="3";"value"="q"}; +{"key"="150";"subkey"="4";"value"="q8z"}; diff --git a/yql/essentials/tests/sql/suites/count/view_input.txt.attr b/yql/essentials/tests/sql/suites/count/view_input.txt.attr new file mode 100644 index 0000000000..07386c98e5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/count/view_input.txt.attr @@ -0,0 +1,32 @@ +{ + "_yql_view_ksv"="SELECT key as k, subkey as s, value as v FROM self"; + "_yql_view_key"="SELECT key FROM self"; + "_yql_row_spec" = { + "Type" = [ + "StructType"; + [ + [ + "key"; + [ + "DataType"; + "String" + ] + ]; + [ + "subkey"; + [ + "DataType"; + "String" + ] + ]; + [ + "value"; + [ + "DataType"; + "String" + ] + ] + ] + ] + } +} |