mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #50546 from auxten/patch-1
Resize BufferFromVector underlying vector only pos_offset == vector.size()
This commit is contained in:
commit
fb4e950f9f
@ -86,7 +86,10 @@ private:
|
|||||||
size_t old_size = vector.size();
|
size_t old_size = vector.size();
|
||||||
/// pos may not be equal to vector.data() + old_size, because WriteBuffer::next() can be used to flush data
|
/// pos may not be equal to vector.data() + old_size, because WriteBuffer::next() can be used to flush data
|
||||||
size_t pos_offset = pos - reinterpret_cast<Position>(vector.data());
|
size_t pos_offset = pos - reinterpret_cast<Position>(vector.data());
|
||||||
vector.resize(old_size * size_multiplier);
|
if (pos_offset == old_size)
|
||||||
|
{
|
||||||
|
vector.resize(old_size * size_multiplier);
|
||||||
|
}
|
||||||
internal_buffer = Buffer(reinterpret_cast<Position>(vector.data() + pos_offset), reinterpret_cast<Position>(vector.data() + vector.size()));
|
internal_buffer = Buffer(reinterpret_cast<Position>(vector.data() + pos_offset), reinterpret_cast<Position>(vector.data() + vector.size()));
|
||||||
working_buffer = internal_buffer;
|
working_buffer = internal_buffer;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user