From d7d22b80e5313fa9d20b58f7cdc38706a4a0bed1 Mon Sep 17 00:00:00 2001 From: Vitaliy Lyudvichenko Date: Thu, 16 Mar 2017 13:39:44 +0300 Subject: [PATCH] Fix Vertical merge in case of OPTIMIZE FINAL with single part. [#CLICKHOUSE-2886] --- dbms/src/DataStreams/ColumnGathererStream.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dbms/src/DataStreams/ColumnGathererStream.cpp b/dbms/src/DataStreams/ColumnGathererStream.cpp index 723cf266bf7..8d487109111 100644 --- a/dbms/src/DataStreams/ColumnGathererStream.cpp +++ b/dbms/src/DataStreams/ColumnGathererStream.cpp @@ -24,6 +24,10 @@ ColumnGathererStream::ColumnGathererStream(const BlockInputStreams & source_stre children.assign(source_streams.begin(), source_streams.end()); + /// Trivial case + if (children.size() == 1) + return; + sources.reserve(children.size()); for (size_t i = 0; i < children.size(); i++) { @@ -150,6 +154,9 @@ void ColumnGathererStream::fetchNewBlock(Source & source, size_t source_num) void ColumnGathererStream::readSuffixImpl() { + if (children.size() == 1) + return; + const BlockStreamProfileInfo & profile_info = getProfileInfo(); double seconds = profile_info.total_stopwatch.elapsedSeconds(); LOG_DEBUG(log, std::fixed << std::setprecision(2)