From 4cf65451de9260cd4fbeaca9c7c3d8e5baec88ac Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Fri, 14 Feb 2020 12:36:00 +0300 Subject: [PATCH] Update SelectStreamFactory. --- .../Interpreters/ClusterProxy/SelectStreamFactory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dbms/src/Interpreters/ClusterProxy/SelectStreamFactory.cpp b/dbms/src/Interpreters/ClusterProxy/SelectStreamFactory.cpp index 0f532fd5332..b3605201dc4 100644 --- a/dbms/src/Interpreters/ClusterProxy/SelectStreamFactory.cpp +++ b/dbms/src/Interpreters/ClusterProxy/SelectStreamFactory.cpp @@ -114,6 +114,7 @@ void SelectStreamFactory::createForShard( Pipes & res) { bool force_add_agg_info = processed_stage == QueryProcessingStage::WithMergeableState; + bool add_totals_port = processed_stage == QueryProcessingStage::Complete; auto modified_query_ast = query_ast->clone(); if (has_virtual_shard_num_column) @@ -135,7 +136,9 @@ void SelectStreamFactory::createForShard( stream->setMainTable(main_table); auto source = std::make_shared(std::move(stream), force_add_agg_info); - source->addTotalsPort(); + + if (add_totals_port) + source->addTotalsPort(); res.emplace_back(std::move(source)); }; @@ -279,7 +282,9 @@ void SelectStreamFactory::createForShard( }; auto source = std::make_shared("LazyShardWithLocalReplica", header, lazily_create_stream, force_add_agg_info); - source->addTotalsPort(); + + if (add_totals_port) + source->addTotalsPort(); res.emplace_back(std::move(source)); }