Disable parallel replicas + FINAL with the analyzer too

This commit is contained in:
Raúl Marín 2023-12-01 13:45:15 +01:00
parent a575d9eef9
commit 485fa70379
2 changed files with 50 additions and 13 deletions

View File

@ -1341,27 +1341,53 @@ void Planner::buildPlanForQueryNode()
const auto & settings = query_context->getSettingsRef();
/// Check support for JOIN for parallel replicas with custom key
if (planner_context->getTableExpressionNodeToData().size() > 1)
if (settings.allow_experimental_parallel_reading_from_replicas > 0)
{
if (settings.allow_experimental_parallel_reading_from_replicas == 1 || !settings.parallel_replicas_custom_key.value.empty())
const auto & table_expression_nodes = planner_context->getTableExpressionNodeToData();
for (const auto & it : table_expression_nodes)
{
LOG_DEBUG(
&Poco::Logger::get("Planner"),
"JOINs are not supported with parallel replicas. Query will be executed without using them.");
auto * table_node = it.first.get()->as<TableNode>();
if (!table_node)
continue;
auto & mutable_context = planner_context->getMutableQueryContext();
mutable_context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0));
mutable_context->setSetting("parallel_replicas_custom_key", String{""});
const auto & modifiers = table_node->getTableExpressionModifiers();
if (modifiers.has_value() && modifiers->hasFinal())
{
if (settings.allow_experimental_parallel_reading_from_replicas == 1)
{
LOG_DEBUG(
&Poco::Logger::get("Planner"),
"FINAL modifier is not supported with parallel replicas. Query will be executed without using them.");
auto & mutable_context = planner_context->getMutableQueryContext();
mutable_context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0));
}
else if (settings.allow_experimental_parallel_reading_from_replicas == 2)
{
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "FINAL modifier is not supported with parallel replicas");
}
}
}
else if (settings.allow_experimental_parallel_reading_from_replicas == 2)
/// Check support for JOIN for parallel replicas with custom key
if (planner_context->getTableExpressionNodeToData().size() > 1)
{
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "JOINs are not supported with parallel replicas");
if (settings.allow_experimental_parallel_reading_from_replicas == 1 || !settings.parallel_replicas_custom_key.value.empty())
{
LOG_DEBUG(
&Poco::Logger::get("Planner"),
"JOINs are not supported with parallel replicas. Query will be executed without using them.");
auto & mutable_context = planner_context->getMutableQueryContext();
mutable_context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0));
mutable_context->setSetting("parallel_replicas_custom_key", String{""});
}
else if (settings.allow_experimental_parallel_reading_from_replicas == 2)
{
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "JOINs are not supported with parallel replicas");
}
}
}
/// TODO: Also disable parallel replicas in case of FINAL
auto top_level_identifiers = collectTopLevelColumnIdentifiers(query_tree, planner_context);
auto join_tree_query_plan = buildJoinTreeQueryPlan(query_tree,
select_query_info,

View File

@ -25,3 +25,14 @@ SETTINGS
allow_experimental_parallel_reading_from_replicas = 1,
use_hedged_requests = 0,
cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost';
SELECT _CAST(NULL, 'Nullable(Nothing)') AS `NULL`
FROM t_02709__fuzz_23 FINAL
GROUP BY
t_02709__fuzz_23.sign,
'1023'
ORDER BY
nan DESC,
_CAST([0, NULL, NULL, NULL, NULL], 'Array(Nullable(UInt8))') DESC
FORMAT Null
SETTINGS receive_timeout = 10., receive_data_timeout_ms = 10000, use_hedged_requests = 0, allow_suspicious_low_cardinality_types = 1, max_parallel_replicas = 3, cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', allow_experimental_parallel_reading_from_replicas = 1, parallel_replicas_for_non_replicated_merge_tree = 1, log_queries = 1, table_function_remote_max_addresses = 200, allow_experimental_analyzer = 1;