Reserve enough memory for memcpySmallAllowReadWriteOverflow15

This commit is contained in:
Raúl Marín 2024-02-05 17:33:14 +01:00
parent 569b8487e8
commit c4e1d09c66

View File

@ -670,8 +670,7 @@ struct ArrayElementStringImpl
ColumnArray::Offset current_offset = 0; ColumnArray::Offset current_offset = 0;
/// get the total result bytes at first, and reduce the cost of result_data.resize. /// get the total result bytes at first, and reduce the cost of result_data.resize.
size_t total_result_bytes = 0; size_t total_result_bytes = 0;
ColumnString::Chars zero_buf(1); ColumnString::Chars zero_buf(16, '\0'); /// Needs 15 extra bytes for memcpySmallAllowReadWriteOverflow15
zero_buf.push_back(0);
std::vector<std::pair<const ColumnString::Char *, UInt64>> selected_bufs; std::vector<std::pair<const ColumnString::Char *, UInt64>> selected_bufs;
selected_bufs.reserve(size); selected_bufs.reserve(size);
for (size_t i = 0; i < size; ++i) for (size_t i = 0; i < size; ++i)
@ -737,8 +736,7 @@ struct ArrayElementStringImpl
size_t size = offsets.size(); size_t size = offsets.size();
result_offsets.resize(size); result_offsets.resize(size);
ColumnString::Chars zero_buf(1); ColumnString::Chars zero_buf(16, '\0'); /// Needs 15 extra bytes for memcpySmallAllowReadWriteOverflow15
zero_buf.push_back(0);
ColumnArray::Offset current_offset = 0; ColumnArray::Offset current_offset = 0;
/// get the total result bytes at first, and reduce the cost of result_data.resize. /// get the total result bytes at first, and reduce the cost of result_data.resize.
size_t total_result_bytes = 0; size_t total_result_bytes = 0;