Disable parallel replicas for joins

This commit is contained in:
Antonio Andelic 2023-03-07 11:24:46 +00:00
parent 2ae0bceb2b
commit f408f750eb
3 changed files with 5 additions and 1 deletions

View File

@ -455,10 +455,11 @@ InterpreterSelectQuery::InterpreterSelectQuery(
}
}
if (joined_tables.tablesCount() > 1 && settings.allow_experimental_parallel_reading_from_replicas)
if (joined_tables.tablesCount() > 1 && (!settings.parallel_replicas_custom_key.value.empty() || settings.allow_experimental_parallel_reading_from_replicas))
{
LOG_WARNING(log, "Joins are not supported with parallel replicas. Query will be executed without using them.");
context->setSetting("allow_experimental_parallel_reading_from_replicas", false);
context->setSetting("parallel_replicas_custom_key", String{""});
}
/// Rewrite JOINs

View File

@ -170,3 +170,4 @@ filter_type='range' max_replicas=3 prefer_localhost_replica=1
0 334
1 333
2 333
1

View File

@ -41,4 +41,6 @@ run_count_with_custom_key "y"
run_count_with_custom_key "cityHash64(y)"
run_count_with_custom_key "cityHash64(y) + 1"
$CLICKHOUSE_CLIENT --query="SELECT count() FROM cluster(test_cluster_one_shard_three_replicas_localhost, currentDatabase(), 02535_custom_key) as t1 JOIN 02535_custom_key USING y" --parallel_replicas_custom_key="y" --send_logs_level="trace" 2>&1 | grep -Fac "Joins are not supported with parallel replicas"
$CLICKHOUSE_CLIENT --query="DROP TABLE 02535_custom_key"