mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Merge pull request #32940 from nkolotov/fix_segfault_object_used_after_move
Fixed segfault when smart pointer is dereferenced after move.
This commit is contained in:
commit
d1d872329c
@ -331,7 +331,8 @@ void ColumnDecimal<T>::gather(ColumnGathererStream & gatherer)
|
||||
template <is_decimal T>
|
||||
ColumnPtr ColumnDecimal<T>::compress() const
|
||||
{
|
||||
size_t source_size = data.size() * sizeof(T);
|
||||
const size_t data_size = data.size();
|
||||
const size_t source_size = data_size * sizeof(T);
|
||||
|
||||
/// Don't compress small blocks.
|
||||
if (source_size < 4096) /// A wild guess.
|
||||
@ -342,8 +343,9 @@ ColumnPtr ColumnDecimal<T>::compress() const
|
||||
if (!compressed)
|
||||
return ColumnCompressed::wrap(this->getPtr());
|
||||
|
||||
return ColumnCompressed::create(data.size(), compressed->size(),
|
||||
[compressed = std::move(compressed), column_size = data.size(), scale = this->scale]
|
||||
const size_t compressed_size = compressed->size();
|
||||
return ColumnCompressed::create(data_size, compressed_size,
|
||||
[compressed = std::move(compressed), column_size = data_size, scale = this->scale]
|
||||
{
|
||||
auto res = ColumnDecimal<T>::create(column_size, scale);
|
||||
ColumnCompressed::decompressBuffer(
|
||||
|
@ -415,9 +415,9 @@ ColumnPtr ColumnFixedString::compress() const
|
||||
if (!compressed)
|
||||
return ColumnCompressed::wrap(this->getPtr());
|
||||
|
||||
size_t column_size = size();
|
||||
|
||||
return ColumnCompressed::create(column_size, compressed->size(),
|
||||
const size_t column_size = size();
|
||||
const size_t compressed_size = compressed->size();
|
||||
return ColumnCompressed::create(column_size, compressed_size,
|
||||
[compressed = std::move(compressed), column_size, n = n]
|
||||
{
|
||||
size_t chars_size = n * column_size;
|
||||
|
@ -474,8 +474,9 @@ void ColumnString::getExtremes(Field & min, Field & max) const
|
||||
|
||||
ColumnPtr ColumnString::compress() const
|
||||
{
|
||||
size_t source_chars_size = chars.size();
|
||||
size_t source_offsets_size = offsets.size() * sizeof(Offset);
|
||||
const size_t source_chars_size = chars.size();
|
||||
const size_t source_offsets_elements = offsets.size();
|
||||
const size_t source_offsets_size = source_offsets_elements * sizeof(Offset);
|
||||
|
||||
/// Don't compress small blocks.
|
||||
if (source_chars_size < 4096) /// A wild guess.
|
||||
@ -489,12 +490,14 @@ ColumnPtr ColumnString::compress() const
|
||||
|
||||
auto offsets_compressed = ColumnCompressed::compressBuffer(offsets.data(), source_offsets_size, true);
|
||||
|
||||
return ColumnCompressed::create(offsets.size(), chars_compressed->size() + offsets_compressed->size(),
|
||||
const size_t chars_compressed_size = chars_compressed->size();
|
||||
const size_t offsets_compressed_size = offsets_compressed->size();
|
||||
return ColumnCompressed::create(source_offsets_elements, chars_compressed_size + offsets_compressed_size,
|
||||
[
|
||||
chars_compressed = std::move(chars_compressed),
|
||||
offsets_compressed = std::move(offsets_compressed),
|
||||
source_chars_size,
|
||||
source_offsets_elements = offsets.size()
|
||||
source_offsets_elements
|
||||
]
|
||||
{
|
||||
auto res = ColumnString::create();
|
||||
|
@ -481,7 +481,8 @@ void ColumnVector<T>::getExtremes(Field & min, Field & max) const
|
||||
template <typename T>
|
||||
ColumnPtr ColumnVector<T>::compress() const
|
||||
{
|
||||
size_t source_size = data.size() * sizeof(T);
|
||||
const size_t data_size = data.size();
|
||||
const size_t source_size = data_size * sizeof(T);
|
||||
|
||||
/// Don't compress small blocks.
|
||||
if (source_size < 4096) /// A wild guess.
|
||||
@ -492,8 +493,9 @@ ColumnPtr ColumnVector<T>::compress() const
|
||||
if (!compressed)
|
||||
return ColumnCompressed::wrap(this->getPtr());
|
||||
|
||||
return ColumnCompressed::create(data.size(), compressed->size(),
|
||||
[compressed = std::move(compressed), column_size = data.size()]
|
||||
const size_t compressed_size = compressed->size();
|
||||
return ColumnCompressed::create(data_size, compressed_size,
|
||||
[compressed = std::move(compressed), column_size = data_size]
|
||||
{
|
||||
auto res = ColumnVector<T>::create(column_size);
|
||||
ColumnCompressed::decompressBuffer(
|
||||
|
Loading…
Reference in New Issue
Block a user