2019-04-18 18:48:04 +00:00
|
|
|
drop table if exists tab_00612;
|
|
|
|
create table tab_00612 (key UInt64, arr Array(UInt64)) Engine = MergeTree order by key;
|
|
|
|
insert into tab_00612 values (1, [1]);
|
|
|
|
insert into tab_00612 values (2, [2]);
|
2018-04-03 19:30:39 +00:00
|
|
|
select 'all';
|
2019-04-18 18:48:04 +00:00
|
|
|
select * from tab_00612 order by key;
|
2018-04-03 19:30:39 +00:00
|
|
|
select 'key, arrayJoin(arr) in (1, 1)';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key, arrayJoin(arr) as val from tab_00612 where (key, val) in (1, 1);
|
2018-04-03 19:30:39 +00:00
|
|
|
select 'key, arrayJoin(arr) in ((1, 1), (2, 2))';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key, arrayJoin(arr) as val from tab_00612 where (key, val) in ((1, 1), (2, 2)) order by key;
|
2018-04-03 19:30:39 +00:00
|
|
|
select '(key, left array join arr) in (1, 1)';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key from tab_00612 left array join arr as val where (key, val) in (1, 1);
|
2018-04-03 19:30:39 +00:00
|
|
|
select '(key, left array join arr) in ((1, 1), (2, 2))';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key from tab_00612 left array join arr as val where (key, val) in ((1, 1), (2, 2)) order by key;
|
2018-04-03 19:30:39 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
drop table if exists tab_00612;
|
|
|
|
create table tab_00612 (key UInt64, n Nested(x UInt64)) Engine = MergeTree order by key;
|
|
|
|
insert into tab_00612 values (1, [1]);
|
|
|
|
insert into tab_00612 values (2, [2]);
|
2018-04-04 19:36:22 +00:00
|
|
|
select 'all';
|
2019-04-18 18:48:04 +00:00
|
|
|
select * from tab_00612 order by key;
|
2018-04-04 19:36:22 +00:00
|
|
|
select 'key, arrayJoin(n.x) in (1, 1)';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key, arrayJoin(n.x) as val from tab_00612 where (key, val) in (1, 1);
|
2018-04-04 19:36:22 +00:00
|
|
|
select 'key, arrayJoin(n.x) in ((1, 1), (2, 2))';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key, arrayJoin(n.x) as val from tab_00612 where (key, val) in ((1, 1), (2, 2)) order by key;
|
2018-04-04 19:36:22 +00:00
|
|
|
select '(key, left array join n.x) in (1, 1)';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key from tab_00612 left array join n.x as val where (key, val) in (1, 1);
|
2018-04-04 19:36:22 +00:00
|
|
|
select '(key, left array join n.x) in ((1, 1), (2, 2))';
|
2019-04-18 18:48:04 +00:00
|
|
|
select key from tab_00612 left array join n.x as val where (key, val) in ((1, 1), (2, 2)) order by key;
|
|
|
|
select 'max(key) from tab_00612 where (key, left array join n.x) in (1, 1)';
|
|
|
|
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1));
|
|
|
|
select max(key) from tab_00612 left array join n as val where (key, val.x) in (1, 1);
|
|
|
|
select 'max(key) from tab_00612 where (key, left array join n.x) in ((1, 1), (2, 2))';
|
|
|
|
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1), (2, 2));
|
|
|
|
select max(key) from tab_00612 left array join n as val where (key, val.x) in ((1, 1), (2, 2));
|
|
|
|
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1)';
|
2019-08-29 18:45:34 +00:00
|
|
|
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) js2 using key where (key, val) in (1, 1);
|
2019-04-18 18:48:04 +00:00
|
|
|
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2))';
|
2019-08-29 18:45:34 +00:00
|
|
|
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) js2 using key where (key, val) in ((1, 1), (2, 2));
|
2018-04-04 21:02:53 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
drop table if exists tab_00612;
|
|
|
|
CREATE TABLE tab_00612 (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
|
|
|
|
insert into tab_00612 values ( -1, 1, 0 );
|
|
|
|
SELECT count(*) FROM tab_00612 PREWHERE id1 IN (1);
|
2020-07-01 13:25:14 +00:00
|
|
|
|
|
|
|
SELECT count() FROM tab_00612 WHERE (key1, id1) IN (-1, 1) AND (key1, 1) IN (-1, 1) SETTINGS force_primary_key = 1;
|
2019-06-07 15:41:24 +00:00
|
|
|
|
|
|
|
drop table tab_00612;
|