aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/expr/sets.sql
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-20 17:37:57 +0000
committerGitHub <noreply@github.com>2024-11-20 17:37:57 +0000
commitf76323e9b295c15751e51e3443aa47a36bee8023 (patch)
tree4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/expr/sets.sql
parent753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff)
parenta7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff)
downloadydb-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/expr/sets.sql')
-rw-r--r--yql/essentials/tests/sql/suites/expr/sets.sql40
1 files changed, 40 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/expr/sets.sql b/yql/essentials/tests/sql/suites/expr/sets.sql
new file mode 100644
index 0000000000..4984941e5d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/sets.sql
@@ -0,0 +1,40 @@
+/* postgres can not */
+$ns = ($set)->{return ListSort(DictKeys($set))};
+$nd = ($dict)->{return ListSort(DictItems($dict), ($z)->{return $z.0})};
+
+select $ns(ToSet(AsList(1,2,3)));
+
+select SetIsDisjoint(ToSet(AsList(1,2,3)), AsList(7,4));
+
+select SetIsDisjoint(ToSet(AsList(1,2,3)), AsList(3,4));
+
+select SetIsDisjoint(ToSet(AsList(1,2,3)), ToSet(AsList(7,4)));
+select SetIsDisjoint(ToSet(AsList(1,2,3)), ToSet(AsList(3,4)));
+
+select $ns(SetIntersection(ToSet(AsList(1,2,3)), ToSet(AsList(3,4))));
+select $nd(SetIntersection(
+ AsDict(AsTuple(1,"foo"),AsTuple(3,"bar")),
+ AsDict(AsTuple(1,"baz"),AsTuple(2,"qwe")),
+ ($_k, $a, $b)->{ return AsTuple($a, $b) }));
+
+select SetIncludes(ToSet(AsList(1,2,3)), AsList(3,4));
+
+select SetIncludes(ToSet(AsList(1,2,3)), AsList(2,3));
+
+select SetIncludes(ToSet(AsList(1,2,3)), ToSet(AsList(3,4)));
+select SetIncludes(ToSet(AsList(1,2,3)), ToSet(AsList(2,3)));
+
+select $ns(SetDifference(ToSet(AsList(1,2,3)), ToSet(AsList(3,4))));
+select $ns(SetDifference(ToSet(AsList(1,2,3)), ToSet(AsList(2,3))));
+
+select $ns(SetUnion(ToSet(AsList(1,2,3)), ToSet(AsList(3,4))));
+select $nd(SetUnion(
+ AsDict(AsTuple(1,"foo"),AsTuple(3,"bar")),
+ AsDict(AsTuple(1,"baz"),AsTuple(2,"qwe")),
+ ($_k, $a, $b)->{ return AsTuple($a, $b) }));
+
+select $ns(SetSymmetricDifference(ToSet(AsList(1,2,3)), ToSet(AsList(3,4))));
+select $nd(SetSymmetricDifference(
+ AsDict(AsTuple(1,"foo"),AsTuple(3,"bar")),
+ AsDict(AsTuple(1,"baz"),AsTuple(2,"qwe")),
+ ($_k, $a, $b)->{ return AsTuple($a, $b) }));