mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
dbms: fixed leaks [#METR-15352].
This commit is contained in:
parent
bd4b866dc8
commit
577a7d102d
@ -156,8 +156,9 @@ typedef ColumnConst<Array> ColumnConstArray;
|
||||
|
||||
template <typename T> ColumnPtr ColumnConst<T>::convertToFullColumn() const
|
||||
{
|
||||
ColumnVector<T> * res = new ColumnVector<T>;
|
||||
res->getData().assign(s, data);
|
||||
ColumnVector<T> * res_ = new ColumnVector<T>;
|
||||
ColumnPtr res = res_;
|
||||
res_->getData().assign(s, data);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1324,7 +1324,6 @@ public:
|
||||
if (col_fstr_in)
|
||||
{
|
||||
ColumnString * col_str = new ColumnString;
|
||||
|
||||
col_res = col_str;
|
||||
|
||||
ColumnString::Chars_t & out_vec = col_str->getChars();
|
||||
|
@ -408,6 +408,7 @@ public:
|
||||
if (const ColumnUInt32 * times = typeid_cast<const ColumnUInt32 *>(&*block.getByPosition(arguments[0]).column))
|
||||
{
|
||||
ColumnUInt32 * res = new ColumnUInt32;
|
||||
ColumnPtr res_holder = res;
|
||||
ColumnUInt32::Container_t & res_vec = res->getData();
|
||||
const ColumnUInt32::Container_t & vec = times->getData();
|
||||
|
||||
@ -417,7 +418,7 @@ public:
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
res_vec[i] = vec[i] / TIME_SLOT_SIZE * TIME_SLOT_SIZE;
|
||||
|
||||
block.getByPosition(result).column = res;
|
||||
block.getByPosition(result).column = res_holder;
|
||||
}
|
||||
else if (const ColumnConstUInt32 * const_times = typeid_cast<const ColumnConstUInt32 *>(&*block.getByPosition(arguments[0]).column))
|
||||
{
|
||||
@ -551,22 +552,23 @@ public:
|
||||
const ColumnConstUInt32 * const_durations = typeid_cast<const ColumnConstUInt32 *>(&*block.getByPosition(arguments[1]).column);
|
||||
|
||||
ColumnArray * res = new ColumnArray(new ColumnUInt32);
|
||||
ColumnPtr res_holder = res;
|
||||
ColumnUInt32::Container_t & res_values = typeid_cast<ColumnUInt32 &>(res->getData()).getData();
|
||||
|
||||
if (starts && durations)
|
||||
{
|
||||
TimeSlotsImpl<UInt32>::vector_vector(starts->getData(), durations->getData(), res_values, res->getOffsets());
|
||||
block.getByPosition(result).column = res;
|
||||
block.getByPosition(result).column = res_holder;
|
||||
}
|
||||
else if (starts && const_durations)
|
||||
{
|
||||
TimeSlotsImpl<UInt32>::vector_constant(starts->getData(), const_durations->getData(), res_values, res->getOffsets());
|
||||
block.getByPosition(result).column = res;
|
||||
block.getByPosition(result).column = res_holder;
|
||||
}
|
||||
else if (const_starts && durations)
|
||||
{
|
||||
TimeSlotsImpl<UInt32>::constant_vector(const_starts->getData(), durations->getData(), res_values, res->getOffsets());
|
||||
block.getByPosition(result).column = res;
|
||||
block.getByPosition(result).column = res_holder;
|
||||
}
|
||||
else if (const_starts && const_durations)
|
||||
{
|
||||
|
@ -338,6 +338,7 @@ public:
|
||||
typeid_cast<const ColumnConstString *>(&*block.getByPosition(arrayArgumentPosition).column);
|
||||
|
||||
ColumnArray * col_res = new ColumnArray(new ColumnString);
|
||||
ColumnPtr col_res_holder = col_res;
|
||||
ColumnString & res_strings = typeid_cast<ColumnString &>(col_res->getData());
|
||||
ColumnArray::Offsets_t & res_offsets = col_res->getOffsets();
|
||||
ColumnString::Chars_t & res_strings_chars = res_strings.getChars();
|
||||
@ -385,7 +386,7 @@ public:
|
||||
res_offsets.push_back(current_dst_offset);
|
||||
}
|
||||
|
||||
block.getByPosition(result).column = col_res;
|
||||
block.getByPosition(result).column = col_res_holder;
|
||||
}
|
||||
else if (col_const_str)
|
||||
{
|
||||
|
@ -109,8 +109,8 @@ namespace VisibleWidth
|
||||
if (const ColumnVector<T> * col = typeid_cast<const ColumnVector<T> *>(&*column))
|
||||
{
|
||||
ColumnUInt64 * res = new ColumnUInt64(column->size());
|
||||
numWidthVector(col->getData(), res->getData());
|
||||
block.getByPosition(result).column = res;
|
||||
numWidthVector(col->getData(), res->getData());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -158,20 +158,20 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
|
||||
else if (const ColumnString * col = typeid_cast<const ColumnString *>(&*column))
|
||||
{
|
||||
ColumnUInt64 * res = new ColumnUInt64(rows);
|
||||
stringWidthVector(col->getChars(), col->getOffsets(), res->getData());
|
||||
block.getByPosition(result).column = res;
|
||||
stringWidthVector(col->getChars(), col->getOffsets(), res->getData());
|
||||
}
|
||||
else if (const ColumnFixedString * col = typeid_cast<const ColumnFixedString *>(&*column))
|
||||
{
|
||||
ColumnUInt64 * res = new ColumnUInt64(rows);
|
||||
stringWidthFixedVector(col->getChars(), col->getN(), res->getData());
|
||||
block.getByPosition(result).column = res;
|
||||
stringWidthFixedVector(col->getChars(), col->getN(), res->getData());
|
||||
}
|
||||
else if (const ColumnConstString * col = typeid_cast<const ColumnConstString *>(&*column))
|
||||
{
|
||||
UInt64 res = 0;
|
||||
stringWidthConstant(col->getData(), res);
|
||||
block.getByPosition(result).column = new ColumnConstUInt64(rows, res);
|
||||
stringWidthConstant(col->getData(), res);
|
||||
}
|
||||
else if (const ColumnArray * col = typeid_cast<const ColumnArray *>(&*column))
|
||||
{
|
||||
@ -191,6 +191,7 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
|
||||
|
||||
/// Теперь суммируем и кладём в результат.
|
||||
ColumnUInt64 * res = new ColumnUInt64(rows);
|
||||
block.getByPosition(result).column = res;
|
||||
ColumnUInt64::Container_t & vec = res->getData();
|
||||
|
||||
size_t additional_symbols = 0; /// Кавычки.
|
||||
@ -223,8 +224,6 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
|
||||
vec[i] = 1 + std::max(static_cast<size_t>(1),
|
||||
(i == 0 ? col->getOffsets()[0] : (col->getOffsets()[i] - col->getOffsets()[i - 1])) * nested_length);
|
||||
}
|
||||
|
||||
block.getByPosition(result).column = res;
|
||||
}
|
||||
else if (const ColumnTuple * col = typeid_cast<const ColumnTuple *>(&*column))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user