-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Alias, Order by and Distributed tables does not work properly together #86227
Copy link
Copy link
Closed
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
Order by used on a distributed table with an alias seems to shuffle the columns.
Does it reproduce on the most recent release?
Yes - v25.7.2
How to reproduce
Table setup
CREATE TABLE shard_Test ON CLUSTER `{cluster}`
(
`a` String,
`b` Float64,
`c` Float64,
`d` Float64,
`e` Float64 ALIAS b + c,
`f` Float64 ALIAS c + d
)
ENGINE = MergeTree
ORDER BY a;
CREATE TABLE Test ON CLUSTER `{cluster}`
(
`a` String,
`b` Float64,
`c` Float64,
`d` Float64,
`e` Float64 ALIAS b + c,
`f` Float64 ALIAS c + d
)
ENGINE = Distributed('{cluster}', 'default', 'shard_Test', rand());
INSERT INTO Test VALUES('a', 1,2,3);Simple query
SELECT
e,
f
FROM Test
┌─e─┬─f─┐
1. │ 3 │ 5 │
└───┴───┘
Query with order by
SELECT
e,
f
FROM Test
ORDER BY a ASC
┌─e─┬─f─┐
1. │ 5 │ 3 │
└───┴───┘
Expected behavior
Both queries should return the sames results
Additional context
probably linked to #85895
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