ClickHouse/tests/queries/0_stateless/02281_limit_by_distributed.sql
Azat Khuzhin b29a0f3c84 Fix "Cannot create column of type Set" for distributed queries with LIMIT BY
The problem was that after #36454 it requires too much columns.

Fixes: #36454
Fixes: #37045
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-13 20:03:19 +03:00

16 lines
390 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;
-- Simplified version of the reproducer provided in [1].
-- [1]: https://github.com/ClickHouse/ClickHouse/issues/37045
SELECT dummy
FROM remote('127.{1,2}', system.one)
WHERE dummy IN (SELECT 0)
LIMIT 1 BY dummy;