2019-04-16 14:13:13 +00:00
|
|
|
drop table if exists array_intersect;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
create table array_intersect (date Date, arr Array(UInt8)) engine=MergeTree partition by date order by date;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
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', []);
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
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;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
optimize table array_intersect;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
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;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table if exists array_intersect;
|
2019-03-31 03:44:05 +00:00
|
|
|
|
2019-11-14 13:40:07 +00:00
|
|
|
select '-';
|
|
|
|
select arrayIntersect([-100], [156]);
|
|
|
|
select arrayIntersect([1], [257]);
|