ClickHouse/tests/queries/0_stateless/00930_arrayIntersect.sql

31 lines
1.5 KiB
MySQL
Raw Normal View History

drop table if exists array_intersect;
create table array_intersect (date Date, arr Array(UInt8)) engine=MergeTree partition by date order by date;
insert into array_intersect values ('2019-01-01', [1,2,3]);
insert into array_intersect values ('2019-01-01', [1,2]);
insert into array_intersect values ('2019-01-01', [1]);
insert into array_intersect values ('2019-01-01', []);
2020-07-30 21:07:51 +00:00
select arraySort(arrayIntersect(arr, [1,2])) from array_intersect order by arr;
select arraySort(arrayIntersect(arr, [])) from array_intersect order by arr;
select arraySort(arrayIntersect([], arr)) from array_intersect order by arr;
select arraySort(arrayIntersect([1,2], arr)) from array_intersect order by arr;
select arraySort(arrayIntersect([1,2], [1,2,3,4])) from array_intersect order by arr;
select arraySort(arrayIntersect([], [])) from array_intersect order by arr;
optimize table array_intersect;
2020-07-30 21:07:51 +00:00
select arraySort(arrayIntersect(arr, [1,2])) from array_intersect order by arr;
select arraySort(arrayIntersect(arr, [])) from array_intersect order by arr;
select arraySort(arrayIntersect([], arr)) from array_intersect order by arr;
select arraySort(arrayIntersect([1,2], arr)) from array_intersect order by arr;
select arraySort(arrayIntersect([1,2], [1,2,3,4])) from array_intersect order by arr;
select arraySort(arrayIntersect([], [])) from array_intersect order by arr;
drop table if exists array_intersect;
2019-11-14 13:40:07 +00:00
select '-';
2020-07-30 21:07:51 +00:00
select arraySort(arrayIntersect([-100], [156]));
select arraySort(arrayIntersect([1], [257]));