Fix DISTINCT for Distributed and optimize_skip_unused_shards

In case of optimize_skip_unused_shards the getQueryProcessingStage() can
return QueryProcessingStage::WithMergeableState because the whole
cluster has multiple nodes, but optimize_skip_unused_shards can trim it
to 1 and in this case we need final merge that won't be done with
QueryProcessingStage::WithMergeableState only with
QueryProcessingStage::Complete.
This commit is contained in:
Azat Khuzhin 2020-03-24 10:53:42 +03:00
parent 0e925ff7ad
commit b8614de64a

View File

@ -369,9 +369,9 @@ static QueryProcessingStage::Enum getQueryProcessingStageImpl(const Context & co
: QueryProcessingStage::WithMergeableState;
}
QueryProcessingStage::Enum StorageDistributed::getQueryProcessingStage(const Context & context, const ASTPtr &) const
QueryProcessingStage::Enum StorageDistributed::getQueryProcessingStage(const Context & context, const ASTPtr & query_ptr) const
{
auto cluster = getCluster();
auto cluster = getOptimizedCluster(context, query_ptr);
return getQueryProcessingStageImpl(context, cluster);
}