mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 21:03:51 +00:00
c6ffec1fec
Consider the following example: SELECT k FROM (SELECT materialize('foo') AS k, -1 AS v) ORDER BY abs(v) AS _v ASC LIMIT 1 BY k The problem here is that in case of query has LIMIT BY for WithMergeableState* (which is the final state on the remote shard for distributd queries) it returns the following columns: - k - v While it should return: - k - abs(v) So as query w/o LIMIT BY, so that initiator will be able to do the sorting Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
9 lines
174 B
SQL
9 lines
174 B
SQL
SELECT k
|
|
FROM (
|
|
SELECT k, abs(v) AS _v
|
|
FROM remote('127.{1,2}', view(select materialize('foo') as k, -1 as v))
|
|
ORDER BY _v ASC
|
|
LIMIT 1 BY k
|
|
)
|
|
GROUP BY k;
|