Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38708 from ClickHouse/backport/22.5/38371
Backport #38371 to 22.5: Fix `DISTINCT` with `LIMIT` in distributed queries
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/queries/0_stateless/02344_distinct_limit_distiributed.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-1 | ||
1 | ||
11 | ||
12 | ||
13 | ||
14 |
26 changes: 26 additions & 0 deletions
26
tests/queries/0_stateless/02344_distinct_limit_distiributed.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
drop table if exists t_distinct_limit; | ||
|
||
create table t_distinct_limit (d Date, id Int64) | ||
engine = MergeTree partition by toYYYYMM(d) order by d; | ||
|
||
set max_threads = 10; | ||
|
||
insert into t_distinct_limit select '2021-12-15', -1 from numbers(1e6); | ||
insert into t_distinct_limit select '2021-12-15', -1 from numbers(1e6); | ||
insert into t_distinct_limit select '2021-12-15', -1 from numbers(1e6); | ||
insert into t_distinct_limit select '2022-12-15', 1 from numbers(1e6); | ||
insert into t_distinct_limit select '2022-12-15', 1 from numbers(1e6); | ||
insert into t_distinct_limit select '2022-12-16', 11 from numbers(1); | ||
insert into t_distinct_limit select '2023-12-16', 12 from numbers(1); | ||
insert into t_distinct_limit select '2023-12-16', 13 from numbers(1); | ||
insert into t_distinct_limit select '2023-12-16', 14 from numbers(1); | ||
|
||
set max_block_size = 1024; | ||
|
||
select id from | ||
( | ||
select distinct id from remote('127.0.0.1,127.0.0.2', currentDatabase(),t_distinct_limit) limit 10 | ||
) | ||
order by id; | ||
|
||
drop table if exists t_distinct_limit; |