2023-02-09 17:30:57 +00:00
|
|
|
SET allow_experimental_analyzer = 1;
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table IF EXISTS joinbug;
|
2018-01-19 02:21:38 +00:00
|
|
|
|
2022-06-23 08:37:52 +00:00
|
|
|
set allow_deprecated_syntax_for_merge_tree=1;
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE joinbug (
|
2022-03-11 23:45:26 +00:00
|
|
|
event_date Date MATERIALIZED toDate(created, 'Asia/Istanbul'),
|
2018-01-19 02:21:38 +00:00
|
|
|
id UInt64,
|
|
|
|
id2 UInt64,
|
|
|
|
val UInt64,
|
|
|
|
val2 Int32,
|
|
|
|
created UInt64
|
|
|
|
) ENGINE = MergeTree(event_date, (id, id2), 8192);
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
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
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table IF EXISTS joinbug_join;
|
2018-01-19 02:21:38 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE joinbug_join (
|
2018-01-19 02:21:38 +00:00
|
|
|
id UInt64,
|
|
|
|
id2 UInt64,
|
|
|
|
val UInt64,
|
|
|
|
val2 Int32,
|
|
|
|
created UInt64
|
2020-04-13 17:03:11 +00:00
|
|
|
) ENGINE = Join(SEMI, LEFT, id2);
|
2018-01-19 02:21:38 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
insert into joinbug_join (id, id2, val, val2, created)
|
2018-01-19 02:21:38 +00:00
|
|
|
select id, id2, val, val2, created
|
2019-04-16 14:13:13 +00:00
|
|
|
from joinbug;
|
2018-01-19 02:21:38 +00:00
|
|
|
|
2021-06-28 13:44:19 +00:00
|
|
|
select * from joinbug;
|
2018-01-19 02:21:38 +00:00
|
|
|
|
|
|
|
select id, id2, val, val2, created
|
2021-06-28 13:44:19 +00:00
|
|
|
from ( SELECT toUInt64(arrayJoin(range(50))) AS id2 ) js1
|
2020-04-13 17:03:11 +00:00
|
|
|
SEMI LEFT JOIN joinbug_join using id2;
|
2018-01-19 02:21:38 +00:00
|
|
|
|
2021-06-28 13:44:19 +00:00
|
|
|
-- type conversion
|
|
|
|
SELECT * FROM ( SELECT toUInt32(11) AS id2 ) AS js1 SEMI LEFT JOIN joinbug_join USING (id2);
|
2021-03-11 19:35:49 +00:00
|
|
|
|
2021-06-28 13:44:19 +00:00
|
|
|
-- can't convert right side in case on storage join
|
2023-02-09 17:30:57 +00:00
|
|
|
SELECT * FROM ( SELECT toInt64(11) AS id2 ) AS js1 SEMI LEFT JOIN joinbug_join USING (id2); -- { serverError 386 }
|
2021-03-11 19:35:49 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE joinbug;
|
|
|
|
DROP TABLE joinbug_join;
|