diff --git a/src/Interpreters/ClusterProxy/executeQuery.cpp b/src/Interpreters/ClusterProxy/executeQuery.cpp index 33b86854ba9..6cdff939af1 100644 --- a/src/Interpreters/ClusterProxy/executeQuery.cpp +++ b/src/Interpreters/ClusterProxy/executeQuery.cpp @@ -148,7 +148,7 @@ ContextMutablePtr updateSettingsForCluster(const Cluster & cluster, } } if (disable_parallel_replicas) - new_settings.allow_experimental_parallel_reading_from_replicas = false; + new_settings.allow_experimental_parallel_reading_from_replicas = 0; } if (settings.max_execution_time_leaf.value > 0) diff --git a/src/Interpreters/GlobalSubqueriesVisitor.h b/src/Interpreters/GlobalSubqueriesVisitor.h index 5f029395df9..c53e54573c5 100644 --- a/src/Interpreters/GlobalSubqueriesVisitor.h +++ b/src/Interpreters/GlobalSubqueriesVisitor.h @@ -224,7 +224,7 @@ private: data.getContext()->getQueryContext()->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0)); return; } - else if (settings.allow_experimental_parallel_reading_from_replicas == 2) + else if (settings.allow_experimental_parallel_reading_from_replicas >= 2) throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "IN with subquery is not supported with parallel replicas"); } } @@ -282,7 +282,7 @@ private: data.getContext()->getQueryContext()->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0)); return; } - else if (settings.allow_experimental_parallel_reading_from_replicas == 2) + else if (settings.allow_experimental_parallel_reading_from_replicas >= 2) throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "JOIN with parallel replicas is only supported with subqueries"); } } diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index 6eb905fb12d..d34294b4c4b 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -486,7 +486,7 @@ InterpreterSelectQuery::InterpreterSelectQuery( LOG_DEBUG(log, "FINAL modifier is not supported with parallel replicas. Query will be executed without using them."); context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0)); } - else if (settings.allow_experimental_parallel_reading_from_replicas == 2) + else if (settings.allow_experimental_parallel_reading_from_replicas >= 2) { throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "FINAL modifier is not supported with parallel replicas"); } @@ -501,7 +501,7 @@ InterpreterSelectQuery::InterpreterSelectQuery( LOG_DEBUG(log, "To use parallel replicas with plain MergeTree tables please enable setting `parallel_replicas_for_non_replicated_merge_tree`. For now query will be executed without using them."); context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0)); } - else if (settings.allow_experimental_parallel_reading_from_replicas == 2) + else if (settings.allow_experimental_parallel_reading_from_replicas >= 2) { throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "To use parallel replicas with plain MergeTree tables please enable setting `parallel_replicas_for_non_replicated_merge_tree`"); } diff --git a/src/Planner/Planner.cpp b/src/Planner/Planner.cpp index ace6d500482..79e76b43e2b 100644 --- a/src/Planner/Planner.cpp +++ b/src/Planner/Planner.cpp @@ -1347,7 +1347,7 @@ void Planner::buildPlanForQueryNode() { if (planner_context->getPreparedSets().hasSubqueries()) { - if (settings.allow_experimental_parallel_reading_from_replicas == 2) + if (settings.allow_experimental_parallel_reading_from_replicas >= 2) throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "IN with subquery is not supported with parallel replicas"); auto & mutable_context = planner_context->getMutableQueryContext(); @@ -1374,7 +1374,7 @@ void Planner::buildPlanForQueryNode() const auto & modifiers = table_node->getTableExpressionModifiers(); if (modifiers.has_value() && modifiers->hasFinal()) { - if (settings.allow_experimental_parallel_reading_from_replicas == 2) + if (settings.allow_experimental_parallel_reading_from_replicas >= 2) throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "FINAL modifier is not supported with parallel replicas"); else { @@ -1393,7 +1393,7 @@ void Planner::buildPlanForQueryNode() /// Check support for JOIN for parallel replicas with custom key if (planner_context->getTableExpressionNodeToData().size() > 1) { - if (settings.allow_experimental_parallel_reading_from_replicas == 2) + if (settings.allow_experimental_parallel_reading_from_replicas >= 2) throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "JOINs are not supported with parallel replicas"); else { diff --git a/tests/queries/0_stateless/02972_parallel_replicas_cte.sql b/tests/queries/0_stateless/02972_parallel_replicas_cte.sql index 3702184e336..51ce18784da 100644 --- a/tests/queries/0_stateless/02972_parallel_replicas_cte.sql +++ b/tests/queries/0_stateless/02972_parallel_replicas_cte.sql @@ -19,6 +19,11 @@ WITH filtered_groups AS (SELECT a FROM pr_1 WHERE a >= 10000) SELECT count() FROM pr_2 INNER JOIN filtered_groups ON pr_2.a = filtered_groups.a SETTINGS allow_experimental_analyzer = 0, allow_experimental_parallel_reading_from_replicas = 2, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', max_parallel_replicas = 3; -- { serverError SUPPORT_IS_DISABLED } +-- Disabled for any value of allow_experimental_parallel_reading_from_replicas != 1, not just 2 +WITH filtered_groups AS (SELECT a FROM pr_1 WHERE a >= 10000) +SELECT count() FROM pr_2 INNER JOIN filtered_groups ON pr_2.a = filtered_groups.a +SETTINGS allow_experimental_analyzer = 0, allow_experimental_parallel_reading_from_replicas = 512, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', max_parallel_replicas = 3; -- { serverError SUPPORT_IS_DISABLED } + -- Sanitizer SELECT count() FROM pr_2 JOIN numbers(10) as pr_1 ON pr_2.a = pr_1.number SETTINGS allow_experimental_parallel_reading_from_replicas = 1, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', max_parallel_replicas = 3;