diff --git a/src/Core/Settings.h b/src/Core/Settings.h index 6197a7cf6e1..c16efc5717b 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -216,6 +216,7 @@ class IColumn; M(UInt64, parallel_replicas_min_number_of_rows_per_replica, 0, "Limit the number of replicas used in a query to (estimated rows to read / min_number_of_rows_per_replica). The max is still limited by 'max_parallel_replicas'", 0) \ M(Bool, parallel_replicas_prefer_local_join, true, "If true, and JOIN can be executed with parallel replicas algorithm, and all storages of right JOIN part are *MergeTree, local JOIN will be used instead of GLOBAL JOIN.", 0) \ M(UInt64, parallel_replicas_mark_segment_size, 128, "Parts virtually divided into segments to be distributed between replicas for parallel reading. This setting controls the size of these segments. Not recommended to change until you're absolutely sure in what you're doing", 0) \ + M(Bool, parallel_replicas_local_plan, true, "Build local plan for local replica", 0) \ \ M(Bool, skip_unavailable_shards, false, "If true, ClickHouse silently skips unavailable shards. Shard is marked as unavailable when: 1) The shard cannot be reached due to a connection failure. 2) Shard is unresolvable through DNS. 3) Table does not exist on the shard.", 0) \ \ diff --git a/src/Interpreters/ClusterProxy/executeQuery.cpp b/src/Interpreters/ClusterProxy/executeQuery.cpp index 0937e121426..ab25da090d6 100644 --- a/src/Interpreters/ClusterProxy/executeQuery.cpp +++ b/src/Interpreters/ClusterProxy/executeQuery.cpp @@ -498,7 +498,7 @@ void executeQueryWithParallelReplicas( auto external_tables = new_context->getExternalTables(); /// do not build local plan for distributed queries for now (address it later) - if (settings.allow_experimental_analyzer && !shard_num) + if (settings.allow_experimental_analyzer && settings.parallel_replicas_local_plan && !shard_num) { auto read_from_remote = std::make_unique( query_ast,