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,6 +1341,33 @@ void Planner::buildPlanForQueryNode()
const auto & settings = query_context->getSettingsRef();
if (settings.allow_experimental_parallel_reading_from_replicas > 0)
{
const auto & table_expression_nodes = planner_context->getTableExpressionNodeToData();
for (const auto & it : table_expression_nodes)
{
auto * table_node = it.first.get()->as<TableNode>();
if (!table_node)
continue;
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");
}
}
}
/// Check support for JOIN for parallel replicas with custom key
if (planner_context->getTableExpressionNodeToData().size() > 1)
{
@ -1359,8 +1386,7 @@ void Planner::buildPlanForQueryNode()
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,

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;