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

28 lines
1.3 KiB
MySQL
Raw Normal View History

drop table if exists test.array_intersect;
create table test.array_intersect (date Date, arr Array(UInt8)) engine=MergeTree partition by date order by date;
insert into test.array_intersect values ('2019-01-01', [1,2,3]);
insert into test.array_intersect values ('2019-01-01', [1,2]);
insert into test.array_intersect values ('2019-01-01', [1]);
insert into test.array_intersect values ('2019-01-01', []);
2019-03-31 06:59:21 +00:00
select arrayIntersect(arr, [1,2]) from test.array_intersect order by arr;
select arrayIntersect(arr, []) from test.array_intersect order by arr;
select arrayIntersect([], arr) from test.array_intersect order by arr;
select arrayIntersect([1,2], arr) from test.array_intersect order by arr;
select arrayIntersect([1,2], [1,2,3,4]) from test.array_intersect order by arr;
select arrayIntersect([], []) from test.array_intersect order by arr;
optimize table test.array_intersect;
2019-03-31 06:59:21 +00:00
select arrayIntersect(arr, [1,2]) from test.array_intersect order by arr;
select arrayIntersect(arr, []) from test.array_intersect order by arr;
select arrayIntersect([], arr) from test.array_intersect order by arr;
select arrayIntersect([1,2], arr) from test.array_intersect order by arr;
select arrayIntersect([1,2], [1,2,3,4]) from test.array_intersect order by arr;
select arrayIntersect([], []) from test.array_intersect order by arr;
drop table if exists test.array_intersect;