Fix logical error when reading from single-replica cluster using parallel replicas

This commit is contained in:
Michael Kolupaev 2024-12-17 00:55:44 +00:00
parent 0ea5bd9144
commit 57d3fca04b
3 changed files with 5 additions and 1 deletions

View File

@ -631,7 +631,8 @@ void executeQueryWithParallelReplicas(
std::move(analyzed_read_from_merge_tree),
local_replica_index.value());
if (!with_parallel_replicas)
/// If there's only one replica or the source is empty, just read locally.
if (!with_parallel_replicas || pools_to_use.size() == 1)
{
query_plan = std::move(*local_plan);
return;

View File

@ -0,0 +1,2 @@
create table src (y Int8) engine MergeTree order by y as select 1;
select 1 from (select 2 from src) settings enable_parallel_replicas=1, max_parallel_replicas=2, cluster_for_parallel_replicas='test_shard_localhost';