mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
30 lines
1.3 KiB
SQL
30 lines
1.3 KiB
SQL
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', []);
|
|
|
|
select arrayIntersect(arr, [1,2]) from array_intersect order by arr;
|
|
select arrayIntersect(arr, []) from array_intersect order by arr;
|
|
select arrayIntersect([], arr) from array_intersect order by arr;
|
|
select arrayIntersect([1,2], arr) from array_intersect order by arr;
|
|
select arrayIntersect([1,2], [1,2,3,4]) from array_intersect order by arr;
|
|
select arrayIntersect([], []) from array_intersect order by arr;
|
|
|
|
optimize table array_intersect;
|
|
|
|
select arrayIntersect(arr, [1,2]) from array_intersect order by arr;
|
|
select arrayIntersect(arr, []) from array_intersect order by arr;
|
|
select arrayIntersect([], arr) from array_intersect order by arr;
|
|
select arrayIntersect([1,2], arr) from array_intersect order by arr;
|
|
select arrayIntersect([1,2], [1,2,3,4]) from array_intersect order by arr;
|
|
select arrayIntersect([], []) from array_intersect order by arr;
|
|
|
|
drop table if exists array_intersect;
|
|
|
|
select '-';
|
|
select arrayIntersect([-100], [156]);
|
|
select arrayIntersect([1], [257]); |