Fix processing stage with analyzer

This commit is contained in:
Igor Nikonov 2024-05-16 14:24:46 +00:00
parent 48ae7be85c
commit 6ecbb7be6e
2 changed files with 15 additions and 13 deletions

View File

@ -6983,19 +6983,22 @@ QueryProcessingStage::Enum MergeTreeData::getQueryProcessingStage(
const StorageSnapshotPtr &,
SelectQueryInfo &) const
{
if (query_context->getClientInfo().collaborate_with_initiator)
return QueryProcessingStage::Enum::FetchColumns;
/// Parallel replicas
if (query_context->canUseParallelReplicasOnInitiator() && to_stage >= QueryProcessingStage::WithMergeableState)
if (!query_context->getSettingsRef().allow_experimental_analyzer)
{
/// ReplicatedMergeTree
if (supportsReplication())
return QueryProcessingStage::Enum::WithMergeableState;
if (query_context->getClientInfo().collaborate_with_initiator)
return QueryProcessingStage::Enum::FetchColumns;
/// For non-replicated MergeTree we allow them only if parallel_replicas_for_non_replicated_merge_tree is enabled
if (query_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree)
return QueryProcessingStage::Enum::WithMergeableState;
/// Parallel replicas
if (query_context->canUseParallelReplicasOnInitiator() && to_stage >= QueryProcessingStage::WithMergeableState)
{
/// ReplicatedMergeTree
if (supportsReplication())
return QueryProcessingStage::Enum::WithMergeableState;
/// For non-replicated MergeTree we allow them only if parallel_replicas_for_non_replicated_merge_tree is enabled
if (query_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree)
return QueryProcessingStage::Enum::WithMergeableState;
}
}
return QueryProcessingStage::Enum::FetchColumns;

View File

@ -10,7 +10,6 @@ SELECT count() FROM users PREWHERE uid > 2000;
-- enable parallel replicas but with high rows threshold
SET
skip_unavailable_shards=1,
allow_experimental_parallel_reading_from_replicas=1,
max_parallel_replicas=3,
cluster_for_parallel_replicas='parallel_replicas',
@ -20,4 +19,4 @@ parallel_replicas_min_number_of_rows_per_replica=1000;
SELECT '-- count() with parallel replicas -------';
SELECT count() FROM users PREWHERE uid > 2000;
DROP TABLE IF EXISTS users;
DROP TABLE users;