-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Duplicate alias does not work with distributed table #85895
Copy link
Copy link
Open
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release
Description
Describe what's wrong
When querying a distributed table defining alias, if the alias have the same function the query fail with a NUMBER_OF_COLUMNS_DOESNT_MATCH
workaround
-
define the alias only in the shard and define them as simple column in the distributed table ( might have a small negative impact on network )
-
define the alias only once
-
define the alias once and re-use it in another alias
Does it reproduce on the most recent release?
Yes
How to reproduce
create table shard_Test on cluster '{cluster}' (a String, b Float64, c Float64, d Float64 ALIAS b + c, e Float64 ALIAS b + c ) Engine = MergeTree() ORDER BY a;
create table Test on cluster '{cluster}' (a String, b Float64, c Float64, d Float64 ALIAS b + c, e Float64 ALIAS b + c ) Engine = Distributed('{cluster}', 'default', 'shard_Test', rand());Select
sum(d) as f,
sum(e) as g
FROM Test;
Expected behavior
I would expect no error at all or an error when creating the table.
Error message and/or stacktrace
Received exception from server (version 25.7.2):
Code: 20. DB::Exception: Received from localhost:9101. DB::Exception: Number of columns doesn't match (source: 1 and result: 2). (NUMBER_OF_COLUMNS_DOESNT_MATCH)
Additional context
clickhouse v25.7.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release