ClickHouse/tests/queries/0_stateless/00561_storage_join.sql

43 lines
894 B
MySQL
Raw Normal View History

SET any_join_distinct_right_table_keys = 1;
drop table IF EXISTS joinbug;
2018-01-19 02:21:38 +00:00
CREATE TABLE joinbug (
2018-01-19 02:21:38 +00:00
event_date Date MATERIALIZED toDate(created, 'Europe/Moscow'),
id UInt64,
id2 UInt64,
val UInt64,
val2 Int32,
created UInt64
) ENGINE = MergeTree(event_date, (id, id2), 8192);
insert into joinbug (id, id2, val, val2, created) values (1,11,91,81,123456), (2,22,92,82,123457);
2018-01-19 02:21:38 +00:00
drop table IF EXISTS joinbug_join;
2018-01-19 02:21:38 +00:00
CREATE TABLE joinbug_join (
2018-01-19 02:21:38 +00:00
id UInt64,
id2 UInt64,
val UInt64,
val2 Int32,
created UInt64
) ENGINE = Join(ANY, INNER, id2);
insert into joinbug_join (id, id2, val, val2, created)
2018-01-19 02:21:38 +00:00
select id, id2, val, val2, created
from joinbug;
2018-01-19 02:21:38 +00:00
/* expected */
select *
from joinbug;
2018-01-19 02:21:38 +00:00
/* wtf */
select id, id2, val, val2, created
from (
SELECT toUInt64(arrayJoin(range(50))) AS id2
) js1
ANY INNER JOIN joinbug_join using id2;
2018-01-19 02:21:38 +00:00
DROP TABLE joinbug;
DROP TABLE joinbug_join;