diff --git a/src/IO/ReadBufferFromS3.cpp b/src/IO/ReadBufferFromS3.cpp index 5b1d278f4c2..1a358f79a8b 100644 --- a/src/IO/ReadBufferFromS3.cpp +++ b/src/IO/ReadBufferFromS3.cpp @@ -116,6 +116,11 @@ bool ReadBufferFromS3::nextImpl() assert(working_buffer.begin() != nullptr); assert(!internal_buffer.empty()); } + else + { + /// use the buffer returned by `impl` + BufferBase::set(impl->buffer().begin(), impl->buffer().size(), impl->offset()); + } } /// Try to read a next portion of data. @@ -155,7 +160,7 @@ bool ReadBufferFromS3::nextImpl() if (!next_result) return false; - BufferBase::set(impl->buffer().begin(), impl->buffer().size(), impl->offset()); /// use the buffer returned by `impl` + BufferBase::set(impl->buffer().begin(), impl->buffer().size(), impl->offset()); ProfileEvents::increment(ProfileEvents::ReadBufferFromS3Bytes, working_buffer.size()); offset += working_buffer.size();