diff --git a/dbms/include/DB/IO/CompressedWriteBuffer.h b/dbms/include/DB/IO/CompressedWriteBuffer.h index 05fe15a01fa..552ff5e0ce8 100644 --- a/dbms/include/DB/IO/CompressedWriteBuffer.h +++ b/dbms/include/DB/IO/CompressedWriteBuffer.h @@ -26,6 +26,9 @@ private: void nextImpl() { + if (!offset()) + return; + size_t uncompressed_size = offset(); compressed_buffer.resize(uncompressed_size + QUICKLZ_ADDITIONAL_SPACE); diff --git a/dbms/include/DB/IO/WriteBufferFromOStream.h b/dbms/include/DB/IO/WriteBufferFromOStream.h index 125149d4aa5..d1a30150b14 100644 --- a/dbms/include/DB/IO/WriteBufferFromOStream.h +++ b/dbms/include/DB/IO/WriteBufferFromOStream.h @@ -20,6 +20,9 @@ private: void nextImpl() { + if (!offset()) + return; + ostr.write(working_buffer.begin(), offset()); ostr.flush();