You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception: Cannot convert column xxx because it is non constant in source stream but must be constant in result #36300
CREATEdatabaseIF NOT EXISTS test ON cluster cluster_single_shard;
-- create local tableCREATETABLEtest.user_local ON cluster cluster_single_shard (
id Int64,
name String,
age Int32
) ENGINE = MergeTree
ORDER BY name
SETTINGS index_granularity =8192;
-- create distributed tableCREATETABLEtest.user_all ON cluster cluster_single_shard
AStest.user_local
ENGINE = Distributed('cluster_single_shard', 'test', 'user_local', rand());
CREATETABLEtest.event ON cluster cluster_single_shard (
id Int64,
user_id Int64,
content String,
created_time DateTime
) ENGINE = MergeTree
ORDER BY user_id
SETTINGS index_granularity =8192;
INSERT INTOtest.user_local
(id, name, age) VALUES (1, 'aaa', 21);
INSERT INTOtest.event
(id, user_id, content, created_time)
VALUES(1, 1, 'hello', '2022-01-05 12:00:00');
Test case
-- Error: SELECTu.name user_name,
20AS age_group
FROMtest.user_all u
LEFT JOINtest.event e ONu.id=e.user_idWHERE (u.age>=20ANDu.age<30)
ANDe.created_time>'2022-01-01';
Received exception from server (version 22.3.3):
Code: 44. DB::Exception: Received from localhost:9000. DB::Exception: Cannot convert column `age_group` because it is non constant in source stream but must be constant in result. (ILLEGAL_COLUMN)
-- OK: use local table [user_local] to replace distritubed table [user_all]SELECTu.name user_name,
20AS age_group
FROMtest.user_local u
LEFT JOINtest.event e ONu.id=e.user_idWHERE (u.age>=20ANDu.age<30)
ANDe.created_time>'2022-01-01';
-- OK: the 20 in SELECT is not in WHERE condition.SELECTu.name user_name,
20AS age_group
FROMtest.user_all u
LEFT JOINtest.event e ONu.id=e.user_idWHERE (u.age>=21ANDu.age<30)
ANDe.created_time>'2022-01-01';
-- OK: without join, with distributed tableSELECTu.name user_name,
20AS age_group
FROMtest.user_all u
WHERE (u.age>=20ANDu.age<30);
Activity
tavplubix commentedon May 2, 2022
Reproduced on 22.5.1.1
vdimir commentedon May 2, 2022
Maybe related #36279
vdimir commentedon May 6, 2022
Closed via #36542