From 54ea7b0b20b92f2de84cf5a810e008ae2dc6a1af Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 9 Sep 2018 06:28:45 +0300 Subject: [PATCH] Fixed error [#CLICKHOUSE-2] --- dbms/programs/copier/ClusterCopier.cpp | 1 - dbms/src/Interpreters/InterpreterInsertQuery.cpp | 2 +- dbms/src/Storages/StorageBuffer.cpp | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dbms/programs/copier/ClusterCopier.cpp b/dbms/programs/copier/ClusterCopier.cpp index bd86e2d9dd..6b01198253 100644 --- a/dbms/programs/copier/ClusterCopier.cpp +++ b/dbms/programs/copier/ClusterCopier.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/dbms/src/Interpreters/InterpreterInsertQuery.cpp b/dbms/src/Interpreters/InterpreterInsertQuery.cpp index 86164ef270..ea7913eb2c 100644 --- a/dbms/src/Interpreters/InterpreterInsertQuery.cpp +++ b/dbms/src/Interpreters/InterpreterInsertQuery.cpp @@ -101,7 +101,7 @@ BlockIO InterpreterInsertQuery::execute() /// Do not squash blocks if it is a sync INSERT into Distributed, since it lead to double bufferization on client and server side. /// Client-side bufferization might cause excessive timeouts (especially in case of big blocks). - if (!(context.getSettingsRef().insert_distributed_sync && table->getName() == "Distributed")) + if (!(context.getSettingsRef().insert_distributed_sync && table->isRemote())) { out = std::make_shared( out, context.getSettingsRef().min_insert_block_size_rows, context.getSettingsRef().min_insert_block_size_bytes); diff --git a/dbms/src/Storages/StorageBuffer.cpp b/dbms/src/Storages/StorageBuffer.cpp index 31d0e96e49..414c147e9e 100644 --- a/dbms/src/Storages/StorageBuffer.cpp +++ b/dbms/src/Storages/StorageBuffer.cpp @@ -601,9 +601,13 @@ void StorageBuffer::writeBlockToDestination(const Block & block, StoragePtr tabl InterpreterInsertQuery interpreter{insert, context, allow_materialized}; + Block block_to_write; + for (const auto & name : columns_intersection) + block_to_write.insert(block.getByName(name)); + auto block_io = interpreter.execute(); block_io.out->writePrefix(); - block_io.out->write(block); + block_io.out->write(block_to_write); block_io.out->writeSuffix(); } -- GitLab