aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-22 11:56:33 +0000
committerGitHub <noreply@github.com>2024-11-22 11:56:33 +0000
commit15c910fd43eeda6a8bda8248f49535098843485e (patch)
treebbc563312f96145dc93d08893c0677a65529f8d4 /yql/essentials/tests
parent36d42e52673b3cd4cd2e9ce8e0a7fa0c41f35e16 (diff)
parent7f465731d583429b39c34b3ac1fae617d6dba7fd (diff)
downloadydb-15c910fd43eeda6a8bda8248f49535098843485e.tar.gz
Merge pull request #11877 from ydb-platform/mergelibs-241122-0919
Library import 241122-0919
Diffstat (limited to 'yql/essentials/tests')
-rw-r--r--yql/essentials/tests/common/test_framework/udfs_deps/ya.make1
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/result.json56
-rw-r--r--yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql14
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_sample.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_sample.sql36
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_sample_n.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_sample_n.sql32
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_shuffle.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/expr/list_shuffle.sql21
10 files changed, 165 insertions, 0 deletions
diff --git a/yql/essentials/tests/common/test_framework/udfs_deps/ya.make b/yql/essentials/tests/common/test_framework/udfs_deps/ya.make
index 16b320bc3b..7eddcac827 100644
--- a/yql/essentials/tests/common/test_framework/udfs_deps/ya.make
+++ b/yql/essentials/tests/common/test_framework/udfs_deps/ya.make
@@ -19,6 +19,7 @@ SET(
yql/essentials/udfs/common/url_base
yql/essentials/udfs/common/unicode_base
yql/essentials/udfs/common/streaming
+ yql/essentials/udfs/common/vector
yql/essentials/udfs/examples/callables
yql/essentials/udfs/examples/dicts
yql/essentials/udfs/examples/dummylog
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json
index ef8ca7ee6c..c178530713 100644
--- a/yql/essentials/tests/sql/sql2yql/canondata/result.json
+++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json
@@ -2463,6 +2463,13 @@
"uri": "https://{canondata_backend}/1924537/1ab444909086b08bd4fe21c5a43f5e183c647e0a/resource.tar.gz#test_sql2yql.test_aggregate-group_by_session_extended_tuple_/sql.yql"
}
],
+ "test_sql2yql.test[aggregate-group_by_session_nopush]": [
+ {
+ "checksum": "09f9e4a178067f6aaa81b9e9959b4cec",
+ "size": 3177,
+ "uri": "https://{canondata_backend}/212715/fe819b0081800cfcbf6e2512d273e760949a6cc7/resource.tar.gz#test_sql2yql.test_aggregate-group_by_session_nopush_/sql.yql"
+ }
+ ],
"test_sql2yql.test[aggregate-group_by_session_only]": [
{
"checksum": "0c22dd1ef887ea533c6e0621c0937ffa",
@@ -6446,6 +6453,27 @@
"uri": "https://{canondata_backend}/1784117/d56ae82ad9d30397a41490647be1bd2124718f98/resource.tar.gz#test_sql2yql.test_expr-list_replicate_fail_/sql.yql"
}
],
+ "test_sql2yql.test[expr-list_sample]": [
+ {
+ "checksum": "922f4c9c5a2fe848f40272dd15cfde42",
+ "size": 10843,
+ "uri": "https://{canondata_backend}/1924537/278b77accb7596bd976e3e218425469d4b97dcf9/resource.tar.gz#test_sql2yql.test_expr-list_sample_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-list_sample_n]": [
+ {
+ "checksum": "5ce08b8b61ef8b2863f931bc1b986679",
+ "size": 7573,
+ "uri": "https://{canondata_backend}/1924537/278b77accb7596bd976e3e218425469d4b97dcf9/resource.tar.gz#test_sql2yql.test_expr-list_sample_n_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-list_shuffle]": [
+ {
+ "checksum": "3cd4f632706daf9ac8962369e7d0eac3",
+ "size": 4413,
+ "uri": "https://{canondata_backend}/1777230/f0ec95d2b2a3a38fc99b00afc1f2d60d2b3e8548/resource.tar.gz#test_sql2yql.test_expr-list_shuffle_/sql.yql"
+ }
+ ],
"test_sql2yql.test[expr-list_takeskipwhile]": [
{
"checksum": "827d6c45ccb33ccc641531600fa839ce",
@@ -22322,6 +22350,13 @@
"uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_aggregate-group_by_session_extended_tuple_/formatted.sql"
}
],
+ "test_sql_format.test[aggregate-group_by_session_nopush]": [
+ {
+ "checksum": "382f93f1c899dd2d1d5ea6b04575cfef",
+ "size": 372,
+ "uri": "https://{canondata_backend}/212715/fe819b0081800cfcbf6e2512d273e760949a6cc7/resource.tar.gz#test_sql_format.test_aggregate-group_by_session_nopush_/formatted.sql"
+ }
+ ],
"test_sql_format.test[aggregate-group_by_session_only]": [
{
"checksum": "531ee77369e54e2a1616411e89c86bb7",
@@ -26305,6 +26340,27 @@
"uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_expr-list_replicate_fail_/formatted.sql"
}
],
+ "test_sql_format.test[expr-list_sample]": [
+ {
+ "checksum": "a642f47aa5488ecfa6450c114a85903d",
+ "size": 1235,
+ "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_sample_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-list_sample_n]": [
+ {
+ "checksum": "4b04a240db2a66eab919da4fbbf3cdea",
+ "size": 1128,
+ "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_sample_n_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-list_shuffle]": [
+ {
+ "checksum": "73822288846e1fc180736baa4a9548c7",
+ "size": 612,
+ "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_shuffle_/formatted.sql"
+ }
+ ],
"test_sql_format.test[expr-list_takeskipwhile]": [
{
"checksum": "fe413941b62655034d49cd2674f2c947",
diff --git a/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg
new file mode 100644
index 0000000000..9e0b837318
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg
@@ -0,0 +1,2 @@
+in Input session1.txt
+providers yt
diff --git a/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql
new file mode 100644
index 0000000000..fd8e46a071
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql
@@ -0,0 +1,14 @@
+/* syntax version 1 */
+/* postgres can not */
+/* yt can not */
+
+SELECT * FROM (
+ SELECT
+ user,
+ cast(session_start as Int64) as ss,
+ ListSort(AGGREGATE_LIST(ts)) as session,
+ COUNT(1) as session_len
+ FROM plato.Input
+ GROUP BY SessionWindow(ts, 10) as session_start, user
+)
+WHERE ss != 100500; -- should not push down
diff --git a/yql/essentials/tests/sql/suites/expr/list_sample.cfg b/yql/essentials/tests/sql/suites/expr/list_sample.cfg
new file mode 100644
index 0000000000..bb349dd8ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_sample.cfg
@@ -0,0 +1 @@
+providers yt
diff --git a/yql/essentials/tests/sql/suites/expr/list_sample.sql b/yql/essentials/tests/sql/suites/expr/list_sample.sql
new file mode 100644
index 0000000000..fecd4febfa
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_sample.sql
@@ -0,0 +1,36 @@
+/* yt can not */
+$list = ListFromRange(1, 101);
+$test = ($probability, $dependsOn) -> {
+ $sample = ListCollect(ListSample($list, $probability, $dependsOn));
+ RETURN
+ (
+ ListSort(DictKeys(ToSet($sample))) == ListSort($sample),
+ (ListLength($sample), $probability * 100),
+ SetIncludes(ToSet($list), $sample)
+ );
+};
+
+SELECT
+ ListSample(NULL , 1.0) IS NULL AS mustBeTrue1,
+ ListSample(Nothing(OptionalType(ListType(DataType("Uint64")))), 1.0) IS NULL AS mustBeTrue2,
+ ListSample([] , 1.0) == [] AS mustBeTrue3,
+
+ ListSample($list, NULL ) == $list AS mustBeTrue4,
+ ListSample($list, Nothing(OptionalType(DataType("Double")))) == $list AS mustBeTrue5,
+
+ ListSample($list, 0.5, 123) == ListSample($list, 0.5, 123) AS mustBeTrue6,
+
+ $test(0.2, 1) AS result1,
+ $test(0.2, 2) AS result2,
+ $test(0.2, 3) AS result3,
+ $test(0.2, 4) AS result4,
+ $test(0.2, 5) AS result5,
+ $test(0.5, 6) AS result6,
+ $test(0.8, 7) AS result7,
+ $test(1.0, 8) AS result8,
+ $test(0.0, 9) AS result9,
+
+ ListSample($list , 0.1 , 10) AS result10,
+ ListSample(Just($list), 0.1 , 11) AS result11,
+ ListSample($list , Just(0.1), 12) AS result12,
+ ListSample(Just($list), Just(0.1), 13) AS result13;
diff --git a/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg b/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg
new file mode 100644
index 0000000000..bb349dd8ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg
@@ -0,0 +1 @@
+providers yt
diff --git a/yql/essentials/tests/sql/suites/expr/list_sample_n.sql b/yql/essentials/tests/sql/suites/expr/list_sample_n.sql
new file mode 100644
index 0000000000..5ab48e52ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_sample_n.sql
@@ -0,0 +1,32 @@
+/* yt can not */
+$list = ListFromRange(1, 40);
+$test = ($n, $dependsOn) -> {
+ $sample = ListCollect(ListSampleN($list, $n, $dependsOn));
+ RETURN
+ (
+ ListSort(DictKeys(ToSet($sample))) == ListSort($sample),
+ ListLength($sample) == ListMin(AsList($n, ListLength($list))),
+ SetIncludes(ToSet($list), $sample)
+ );
+};
+
+SELECT
+ ListSampleN(NULL , 1ul) IS NULL AS mustBeTrue1,
+ ListSampleN(Nothing(OptionalType(ListType(DataType("Uint64")))), 1ul) IS NULL AS mustBeTrue2,
+ ListSampleN([] , 1ul) == [] AS mustBeTrue3,
+
+ ListSampleN($list, NULL ) == $list AS mustBeTrue4,
+ ListSampleN($list, Nothing(OptionalType(DataType("Uint64")))) == $list AS mustBeTrue5,
+
+ ListSampleN($list, 25ul, 123) == ListSampleN($list, 25ul, 123) AS mustBeTrue6,
+
+ $test(5ul, 1) AS result1,
+ $test(10ul, 2) AS result2,
+ $test(20ul, 3) AS result3,
+ $test(0ul, 4) AS result4,
+ $test(100ul, 5) AS result5,
+
+ ListSampleN($list , 10ul , 6) AS result6,
+ ListSampleN(Just($list), 10ul , 7) AS result7,
+ ListSampleN($list , Just(10ul), 8) AS result8,
+ ListSampleN(Just($list), Just(10ul), 9) AS result9;
diff --git a/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg b/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg
new file mode 100644
index 0000000000..bb349dd8ab
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg
@@ -0,0 +1 @@
+providers yt
diff --git a/yql/essentials/tests/sql/suites/expr/list_shuffle.sql b/yql/essentials/tests/sql/suites/expr/list_shuffle.sql
new file mode 100644
index 0000000000..8051e76ad3
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/list_shuffle.sql
@@ -0,0 +1,21 @@
+/* yt can not */
+$list = ListFromRange(1, 40);
+$test = ($c) -> {
+ $shuffle = ListCollect(ListShuffle($list, $c));
+ RETURN ListSort($shuffle) == ListSort($list);
+};
+
+SELECT
+ ListShuffle(NULL ) IS NULL AS mustBeTrue1,
+ ListShuffle(Nothing(OptionalType(ListType(DataType("Uint64"))))) IS NULL AS mustBeTrue2,
+ ListShuffle([] ) == [] AS mustBeTrue3,
+
+ ListShuffle($list, 123) == ListShuffle($list, 123) AS mustBeTrue4,
+
+ $test(1) AS result1,
+ $test(2) AS result2,
+ $test(3) AS result3,
+ $test(4) AS result4,
+
+ ListShuffle($list , 5) AS result5,
+ ListShuffle(Just($list), 6) AS result6;