Better semantic of sharing columns: development [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-12-14 04:43:19 +03:00
parent 0b8688e89b
commit f3bb24a3bf
103 changed files with 572 additions and 529 deletions

2
contrib/poco vendored

@ -1 +1 @@
Subproject commit bcf9ebad48b2162d25f5fc432b176d74a09f498d
Subproject commit 81d4fdfcb887f89b0f7b1e9b503cbe63e6d8366b

View File

@ -31,7 +31,7 @@ namespace ErrorCodes
}
ColumnArray::ColumnArray(const MutableColumnPtr & nested_column, const MutableColumnPtr & offsets_column)
ColumnArray::ColumnArray(const ColumnPtr & nested_column, const ColumnPtr & offsets_column)
: data(nested_column), offsets(offsets_column)
{
if (!typeid_cast<ColumnOffsets_t *>(offsets_column.get()))
@ -44,12 +44,18 @@ ColumnArray::ColumnArray(const MutableColumnPtr & nested_column, const MutableCo
}
ColumnArray::ColumnArray(const ColumnArray & src)
: data(src.data), offsets(src.offsets)
{
}
std::string ColumnArray::getName() const { return "Array(" + getData().getName() + ")"; }
ColumnPtr ColumnArray::cloneResized(size_t to_size) const
MutableColumnPtr ColumnArray::cloneResized(size_t to_size) const
{
auto res = std::make_shared<ColumnArray>(getData().cloneEmpty());
auto res = ColumnArray::create(getData().cloneEmpty(), ColumnOffsets_t::create());
if (to_size == 0)
return res;
@ -71,7 +77,7 @@ ColumnPtr ColumnArray::cloneResized(size_t to_size) const
if (from_size > 0)
{
res->getOffsets().assign(getOffsets().begin(), getOffsets().end());
res->getDataPtr() = getData().clone();
res->data = getData().clone();
offset = getOffsets().back();
}
@ -311,7 +317,7 @@ bool ColumnArray::hasEqualOffsets(const ColumnArray & other) const
}
ColumnPtr ColumnArray::convertToFullColumnIfConst() const
MutableColumnPtr ColumnArray::convertToFullColumnIfConst() const
{
ColumnPtr new_data;
@ -320,7 +326,7 @@ ColumnPtr ColumnArray::convertToFullColumnIfConst() const
else
new_data = data;
return std::make_shared<ColumnArray>(new_data, offsets);
return ColumnArray::create(new_data, offsets);
}
@ -385,7 +391,7 @@ void ColumnArray::insertRangeFrom(const IColumn & src, size_t start, size_t leng
}
ColumnPtr ColumnArray::filter(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filter(const Filter & filt, ssize_t result_size_hint) const
{
if (typeid_cast<const ColumnUInt8 *>(data.get())) return filterNumber<UInt8>(filt, result_size_hint);
if (typeid_cast<const ColumnUInt16 *>(data.get())) return filterNumber<UInt16>(filt, result_size_hint);
@ -404,12 +410,12 @@ ColumnPtr ColumnArray::filter(const Filter & filt, ssize_t result_size_hint) con
}
template <typename T>
ColumnPtr ColumnArray::filterNumber(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filterNumber(const Filter & filt, ssize_t result_size_hint) const
{
if (getOffsets().size() == 0)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
auto res = std::make_shared<ColumnArray>(data->cloneEmpty());
auto res = ColumnArray::create(data->cloneEmpty(), ColumnOffsets_t::create());
auto & res_elems = static_cast<ColumnVector<T> &>(res->getData()).getData();
Offsets_t & res_offsets = res->getOffsets();
@ -418,16 +424,16 @@ ColumnPtr ColumnArray::filterNumber(const Filter & filt, ssize_t result_size_hin
return res;
}
ColumnPtr ColumnArray::filterString(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filterString(const Filter & filt, ssize_t result_size_hint) const
{
size_t col_size = getOffsets().size();
if (col_size != filt.size())
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (0 == col_size)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
auto res = std::make_shared<ColumnArray>(data->cloneEmpty());
auto res = ColumnArray::create(data->cloneEmpty(), ColumnOffsets_t::create());
const ColumnString & src_string = typeid_cast<const ColumnString &>(*data);
const ColumnString::Chars_t & src_chars = src_string.getChars();
@ -486,14 +492,14 @@ ColumnPtr ColumnArray::filterString(const Filter & filt, ssize_t result_size_hin
return res;
}
ColumnPtr ColumnArray::filterGeneric(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filterGeneric(const Filter & filt, ssize_t result_size_hint) const
{
size_t size = getOffsets().size();
if (size != filt.size())
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (size == 0)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
Filter nested_filt(getOffsets().back());
for (size_t i = 0; i < size; ++i)
@ -504,7 +510,7 @@ ColumnPtr ColumnArray::filterGeneric(const Filter & filt, ssize_t result_size_hi
memset(&nested_filt[offsetAt(i)], 0, sizeAt(i));
}
std::shared_ptr<ColumnArray> res = std::make_shared<ColumnArray>(data);
std::shared_ptr<ColumnArray> res = ColumnArray::create(data, ColumnOffsets_t::create());
ssize_t nested_result_size_hint = 0;
if (result_size_hint < 0)
@ -531,21 +537,21 @@ ColumnPtr ColumnArray::filterGeneric(const Filter & filt, ssize_t result_size_hi
return res;
}
ColumnPtr ColumnArray::filterNullable(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filterNullable(const Filter & filt, ssize_t result_size_hint) const
{
if (getOffsets().size() == 0)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
const ColumnNullable & nullable_elems = static_cast<const ColumnNullable &>(*data);
auto array_of_nested = std::make_shared<ColumnArray>(nullable_elems.getNestedColumn(), offsets);
auto array_of_nested = ColumnArray::create(nullable_elems.getNestedColumn(), offsets);
auto filtered_array_of_nested_owner = array_of_nested->filter(filt, result_size_hint);
auto & filtered_array_of_nested = static_cast<ColumnArray &>(*filtered_array_of_nested_owner);
auto & filtered_offsets = filtered_array_of_nested.getOffsetsColumn();
auto res_null_map = std::make_shared<ColumnUInt8>();
auto res = std::make_shared<ColumnArray>(
std::make_shared<ColumnNullable>(
auto res_null_map = ColumnUInt8::create();
auto res = ColumnArray::create(
ColumnNullable::create(
filtered_array_of_nested.getDataPtr(),
res_null_map),
filtered_offsets);
@ -554,10 +560,10 @@ ColumnPtr ColumnArray::filterNullable(const Filter & filt, ssize_t result_size_h
return res;
}
ColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint) const
MutableColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint) const
{
if (getOffsets().size() == 0)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
const ColumnTuple & tuple = static_cast<const ColumnTuple &>(*data);
@ -576,13 +582,13 @@ ColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint
for (size_t i = 0; i < tuple_size; ++i)
tuple_columns[i] = static_cast<ColumnArray &>(*temporary_arrays[i]).getDataPtr();
return std::make_shared<ColumnArray>(
std::make_shared<ColumnTuple>(tuple_columns),
return ColumnArray::create(
ColumnTuple::create(tuple_columns),
static_cast<ColumnArray &>(*temporary_arrays.front()).getOffsetsColumn());
}
ColumnPtr ColumnArray::permute(const Permutation & perm, size_t limit) const
MutableColumnPtr ColumnArray::permute(const Permutation & perm, size_t limit) const
{
size_t size = getOffsets().size();
@ -595,11 +601,11 @@ ColumnPtr ColumnArray::permute(const Permutation & perm, size_t limit) const
throw Exception("Size of permutation is less than required.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (limit == 0)
return std::make_shared<ColumnArray>(data);
return ColumnArray::create(data, ColumnOffsets_t::create());
Permutation nested_perm(getOffsets().back());
std::shared_ptr<ColumnArray> res = std::make_shared<ColumnArray>(data->cloneEmpty());
std::shared_ptr<ColumnArray> res = ColumnArray::create(data->cloneEmpty(), ColumnOffsets_t::create());
Offsets_t & res_offsets = res->getOffsets();
res_offsets.resize(limit);
@ -646,7 +652,7 @@ void ColumnArray::getPermutation(bool reverse, size_t limit, int nan_direction_h
}
ColumnPtr ColumnArray::replicate(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicate(const Offsets_t & replicate_offsets) const
{
if (typeid_cast<const ColumnUInt8 *>(data.get())) return replicateNumber<UInt8>(replicate_offsets);
if (typeid_cast<const ColumnUInt16 *>(data.get())) return replicateNumber<UInt16>(replicate_offsets);
@ -667,13 +673,13 @@ ColumnPtr ColumnArray::replicate(const Offsets_t & replicate_offsets) const
template <typename T>
ColumnPtr ColumnArray::replicateNumber(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateNumber(const Offsets_t & replicate_offsets) const
{
size_t col_size = size();
if (col_size != replicate_offsets.size())
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
ColumnPtr res = cloneEmpty();
MutableColumnPtr res = cloneEmpty();
if (0 == col_size)
return res;
@ -715,13 +721,13 @@ ColumnPtr ColumnArray::replicateNumber(const Offsets_t & replicate_offsets) cons
}
ColumnPtr ColumnArray::replicateString(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateString(const Offsets_t & replicate_offsets) const
{
size_t col_size = size();
if (col_size != replicate_offsets.size())
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
ColumnPtr res = cloneEmpty();
MutableColumnPtr res = cloneEmpty();
if (0 == col_size)
return res;
@ -790,7 +796,7 @@ ColumnPtr ColumnArray::replicateString(const Offsets_t & replicate_offsets) cons
}
ColumnPtr ColumnArray::replicateConst(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateConst(const Offsets_t & replicate_offsets) const
{
size_t col_size = size();
if (col_size != replicate_offsets.size())
@ -801,7 +807,7 @@ ColumnPtr ColumnArray::replicateConst(const Offsets_t & replicate_offsets) const
const Offsets_t & src_offsets = getOffsets();
auto res_column_offsets = std::make_shared<ColumnOffsets_t>();
auto res_column_offsets = ColumnOffsets_t::create();
Offsets_t & res_offsets = res_column_offsets->getData();
res_offsets.reserve(replicate_offsets.back());
@ -824,17 +830,17 @@ ColumnPtr ColumnArray::replicateConst(const Offsets_t & replicate_offsets) const
prev_data_offset = src_offsets[i];
}
return std::make_shared<ColumnArray>(getData().cloneResized(current_new_offset), res_column_offsets);
return ColumnArray::create(getData().cloneResized(current_new_offset), res_column_offsets);
}
ColumnPtr ColumnArray::replicateGeneric(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateGeneric(const Offsets_t & replicate_offsets) const
{
size_t col_size = size();
if (col_size != replicate_offsets.size())
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
ColumnPtr res = cloneEmpty();
MutableColumnPtr res = cloneEmpty();
ColumnArray & res_concrete = static_cast<ColumnArray &>(*res);
if (0 == col_size)
@ -854,7 +860,7 @@ ColumnPtr ColumnArray::replicateGeneric(const Offsets_t & replicate_offsets) con
}
ColumnPtr ColumnArray::replicateNullable(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateNullable(const Offsets_t & replicate_offsets) const
{
const ColumnNullable & nullable = static_cast<const ColumnNullable &>(*data);
@ -864,15 +870,15 @@ ColumnPtr ColumnArray::replicateNullable(const Offsets_t & replicate_offsets) co
auto array_of_nested = ColumnArray(nullable.getNestedColumn(), getOffsetsColumn()).replicate(replicate_offsets);
auto array_of_null_map = ColumnArray(nullable.getNullMapColumn(), getOffsetsColumn()).replicate(replicate_offsets);
return std::make_shared<ColumnArray>(
std::make_shared<ColumnNullable>(
return ColumnArray::create(
ColumnNullable::create(
static_cast<ColumnArray &>(*array_of_nested).getDataPtr(),
static_cast<ColumnArray &>(*array_of_null_map).getDataPtr()),
static_cast<ColumnArray &>(*array_of_nested).getOffsetsColumn());
}
ColumnPtr ColumnArray::replicateTuple(const Offsets_t & replicate_offsets) const
MutableColumnPtr ColumnArray::replicateTuple(const Offsets_t & replicate_offsets) const
{
const ColumnTuple & tuple = static_cast<const ColumnTuple &>(*data);
@ -891,8 +897,8 @@ ColumnPtr ColumnArray::replicateTuple(const Offsets_t & replicate_offsets) const
for (size_t i = 0; i < tuple_size; ++i)
tuple_columns[i] = static_cast<ColumnArray &>(*temporary_arrays[i]).getDataPtr();
return std::make_shared<ColumnArray>(
std::make_shared<ColumnTuple>(tuple_columns),
return ColumnArray::create(
ColumnTuple::create(tuple_columns),
static_cast<ColumnArray &>(*temporary_arrays.front()).getOffsetsColumn());
}
@ -901,7 +907,7 @@ ColumnPtr ColumnArray::getLengthsColumn() const
{
const auto & offsets_data = getOffsets();
size_t size = offsets_data.size();
auto column = std::make_shared<ColumnVector<ColumnArray::Offset_t>>(offsets->size());
auto column = ColumnVector<ColumnArray::Offset_t>::create(offsets->size());
auto & data = column->getData();
if (size)

View File

@ -22,7 +22,9 @@ class ColumnArray final : public COWPtrHelper<IColumn, ColumnArray>
{
private:
/** Create an empty column of arrays with the type of values as in the column `nested_column` */
ColumnArray(const MutableColumnPtr & nested_column, const MutableColumnPtr & offsets_column);
ColumnArray(const ColumnPtr & nested_column, const ColumnPtr & offsets_column);
ColumnArray(const ColumnArray & src);
public:
/** On the index i there is an offset to the beginning of the i + 1 -th element. */
@ -58,23 +60,23 @@ public:
bool hasEqualOffsets(const ColumnArray & other) const;
/** More efficient methods of manipulation */
IColumn & getData() { return *data.get(); }
const IColumn & getData() const { return *data.get(); }
IColumn & getData() { return *data->assumeMutable(); }
const IColumn & getData() const { return *data; }
MutableColumnPtr & getDataPtr() { return data; }
//MutableColumnPtr & getDataPtr() { return data->assumeMutable(); }
const ColumnPtr & getDataPtr() const { return data; }
Offsets_t & ALWAYS_INLINE getOffsets()
{
return static_cast<ColumnOffsets_t &>(*offsets.get()).getData();
return static_cast<ColumnOffsets_t &>(*offsets->assumeMutable()).getData();
}
const Offsets_t & ALWAYS_INLINE getOffsets() const
{
return static_cast<const ColumnOffsets_t &>(*offsets.get()).getData();
return static_cast<const ColumnOffsets_t &>(*offsets).getData();
}
MutableColumnPtr & getOffsetsColumn() { return offsets; }
//MutableColumnPtr & getOffsetsColumn() { return offsets->assumeMutable(); }
const ColumnPtr & getOffsetsColumn() const { return offsets; }
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override
@ -91,8 +93,8 @@ public:
}
private:
MutableColumnPtr data;
MutableColumnPtr offsets;
ColumnPtr data;
ColumnPtr offsets;
size_t ALWAYS_INLINE offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
size_t ALWAYS_INLINE sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }

View File

@ -47,7 +47,7 @@ public:
ColumnPtr cloneResized(size_t new_size) const override
{
return std::make_shared<ColumnConst>(data, new_size);
return ColumnConst::create(data, new_size);
}
size_t size() const override
@ -148,7 +148,7 @@ public:
if (s != filt.size())
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
return std::make_shared<ColumnConst>(data, countBytesInFilter(filt));
return ColumnConst::create(data, countBytesInFilter(filt));
}
ColumnPtr replicate(const Offsets_t & offsets) const override
@ -157,7 +157,7 @@ public:
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
size_t replicated_size = 0 == s ? 0 : offsets.back();
return std::make_shared<ColumnConst>(data, replicated_size);
return ColumnConst::create(data, replicated_size);
}
size_t byteSize() const override
@ -180,7 +180,7 @@ public:
if (perm.size() < limit)
throw Exception("Size of permutation is less than required.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
return std::make_shared<ColumnConst>(data, limit);
return ColumnConst::create(data, limit);
}
int compareAt(size_t, size_t, const IColumn & rhs, int nan_direction_hint) const override

View File

@ -19,7 +19,7 @@ ColumnExpression::ColumnExpression(
ColumnPtr ColumnExpression::cloneDummy(size_t s_) const
{
return std::make_shared<ColumnExpression>(s_, expression, arguments, return_type, return_name);
return ColumnExpression::create(s_, expression, arguments, return_type, return_name);
}
const ExpressionActionsPtr & ColumnExpression::getExpression() const { return expression; }

View File

@ -27,7 +27,7 @@ namespace ErrorCodes
ColumnPtr ColumnFixedString::cloneResized(size_t size) const
{
ColumnPtr new_col_holder = std::make_shared<ColumnFixedString>(n);
ColumnPtr new_col_holder = ColumnFixedString::create(n);
if (size > 0)
{
@ -159,7 +159,7 @@ ColumnPtr ColumnFixedString::filter(const IColumn::Filter & filt, ssize_t result
if (col_size != filt.size())
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
std::shared_ptr<ColumnFixedString> res = std::make_shared<ColumnFixedString>(n);
std::shared_ptr<ColumnFixedString> res = ColumnFixedString::create(n);
if (result_size_hint)
res->chars.reserve(result_size_hint > 0 ? result_size_hint * n : chars.size());
@ -243,9 +243,9 @@ ColumnPtr ColumnFixedString::permute(const Permutation & perm, size_t limit) con
throw Exception("Size of permutation is less than required.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (limit == 0)
return std::make_shared<ColumnFixedString>(n);
return ColumnFixedString::create(n);
std::shared_ptr<ColumnFixedString> res = std::make_shared<ColumnFixedString>(n);
std::shared_ptr<ColumnFixedString> res = ColumnFixedString::create(n);
Chars_t & res_chars = res->chars;
@ -264,7 +264,7 @@ ColumnPtr ColumnFixedString::replicate(const Offsets_t & offsets) const
if (col_size != offsets.size())
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
std::shared_ptr<ColumnFixedString> res = std::make_shared<ColumnFixedString>(n);
std::shared_ptr<ColumnFixedString> res = ColumnFixedString::create(n);
if (0 == col_size)
return res;

View File

@ -12,7 +12,7 @@ public:
using IColumnDummy::IColumnDummy;
const char * getFamilyName() const override { return "Nothing"; }
ColumnPtr cloneDummy(size_t s) const override { return std::make_shared<ColumnNothing>(s); };
ColumnPtr cloneDummy(size_t s) const override { return ColumnNothing::create(s); };
bool canBeInsideNullable() const override { return true; }
};

View File

@ -45,7 +45,7 @@ void ColumnNullable::updateHashWithValue(size_t n, SipHash & hash) const
ColumnPtr ColumnNullable::cloneResized(size_t new_size) const
{
ColumnPtr new_nested_col = nested_column->cloneResized(new_size);
auto new_null_map = std::make_shared<ColumnUInt8>();
auto new_null_map = ColumnUInt8::create();
if (new_size > 0)
{
@ -59,7 +59,7 @@ ColumnPtr ColumnNullable::cloneResized(size_t new_size) const
memset(&new_null_map->getData()[count], 1, new_size - count);
}
return std::make_shared<ColumnNullable>(new_nested_col, new_null_map);
return ColumnNullable::create(new_nested_col, new_null_map);
}
@ -162,14 +162,14 @@ ColumnPtr ColumnNullable::filter(const Filter & filt, ssize_t result_size_hint)
{
ColumnPtr filtered_data = nested_column->filter(filt, result_size_hint);
ColumnPtr filtered_null_map = getNullMapConcreteColumn().filter(filt, result_size_hint);
return std::make_shared<ColumnNullable>(filtered_data, filtered_null_map);
return ColumnNullable::create(filtered_data, filtered_null_map);
}
ColumnPtr ColumnNullable::permute(const Permutation & perm, size_t limit) const
{
ColumnPtr permuted_data = nested_column->permute(perm, limit);
ColumnPtr permuted_null_map = getNullMapConcreteColumn().permute(perm, limit);
return std::make_shared<ColumnNullable>(permuted_data, permuted_null_map);
return ColumnNullable::create(permuted_data, permuted_null_map);
}
int ColumnNullable::compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const
@ -394,7 +394,7 @@ ColumnPtr ColumnNullable::replicate(const Offsets_t & offsets) const
{
ColumnPtr replicated_data = nested_column->replicate(offsets);
ColumnPtr replicated_null_map = getNullMapConcreteColumn().replicate(offsets);
return std::make_shared<ColumnNullable>(replicated_data, replicated_null_map);
return ColumnNullable::create(replicated_data, replicated_null_map);
}
@ -443,9 +443,9 @@ ColumnPtr makeNullable(const ColumnPtr & column)
return column;
if (column->isColumnConst())
return std::make_shared<ColumnConst>(makeNullable(static_cast<ColumnConst &>(*column).getDataColumnPtr()), column->size());
return ColumnConst::create(makeNullable(static_cast<ColumnConst &>(*column).getDataColumnPtr()), column->size());
return std::make_shared<ColumnNullable>(column, std::make_shared<ColumnUInt8>(column->size(), 0));
return ColumnNullable::create(column, ColumnUInt8::create(column->size(), 0));
}
}

View File

@ -20,7 +20,7 @@ public:
ColumnSet(size_t s_, const ConstSetPtr & data_) : IColumnDummy(s_), data(data_) {}
const char * getFamilyName() const override { return "Set"; }
ColumnPtr cloneDummy(size_t s_) const override { return std::make_shared<ColumnSet>(s_, data); }
ColumnPtr cloneDummy(size_t s_) const override { return ColumnSet::create(s_, data); }
ConstSetPtr getData() const { return data; }

View File

@ -21,7 +21,7 @@ namespace ErrorCodes
ColumnPtr ColumnString::cloneResized(size_t to_size) const
{
auto res = std::make_shared<ColumnString>();
auto res = ColumnString::create();
if (to_size == 0)
return res;
@ -100,9 +100,9 @@ void ColumnString::insertRangeFrom(const IColumn & src, size_t start, size_t len
ColumnPtr ColumnString::filter(const Filter & filt, ssize_t result_size_hint) const
{
if (offsets.size() == 0)
return std::make_shared<ColumnString>();
return ColumnString::create();
auto res = std::make_shared<ColumnString>();
auto res = ColumnString::create();
Chars_t & res_chars = res->chars;
Offsets_t & res_offsets = res->offsets;
@ -125,9 +125,9 @@ ColumnPtr ColumnString::permute(const Permutation & perm, size_t limit) const
throw Exception("Size of permutation is less than required.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (limit == 0)
return std::make_shared<ColumnString>();
return ColumnString::create();
std::shared_ptr<ColumnString> res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> res = ColumnString::create();
Chars_t & res_chars = res->chars;
Offsets_t & res_offsets = res->offsets;
@ -214,7 +214,7 @@ ColumnPtr ColumnString::replicate(const Offsets_t & replicate_offsets) const
if (col_size != replicate_offsets.size())
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
std::shared_ptr<ColumnString> res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> res = ColumnString::create();
if (0 == col_size)
return res;

View File

@ -45,7 +45,7 @@ ColumnPtr ColumnTuple::cloneEmpty() const
for (size_t i = 0; i < tuple_size; ++i)
new_columns[i] = columns[i]->cloneEmpty();
return std::make_shared<ColumnTuple>(new_columns);
return ColumnTuple::create(new_columns);
}
Field ColumnTuple::operator[](size_t n) const
@ -148,7 +148,7 @@ ColumnPtr ColumnTuple::filter(const Filter & filt, ssize_t result_size_hint) con
for (size_t i = 0; i < tuple_size; ++i)
new_columns[i] = columns[i]->filter(filt, result_size_hint);
return std::make_shared<ColumnTuple>(new_columns);
return ColumnTuple::create(new_columns);
}
ColumnPtr ColumnTuple::permute(const Permutation & perm, size_t limit) const
@ -159,7 +159,7 @@ ColumnPtr ColumnTuple::permute(const Permutation & perm, size_t limit) const
for (size_t i = 0; i < tuple_size; ++i)
new_columns[i] = columns[i]->permute(perm, limit);
return std::make_shared<ColumnTuple>(new_columns);
return ColumnTuple::create(new_columns);
}
ColumnPtr ColumnTuple::replicate(const Offsets_t & offsets) const
@ -170,7 +170,7 @@ ColumnPtr ColumnTuple::replicate(const Offsets_t & offsets) const
for (size_t i = 0; i < tuple_size; ++i)
new_columns[i] = columns[i]->replicate(offsets);
return std::make_shared<ColumnTuple>(new_columns);
return ColumnTuple::create(new_columns);
}
Columns ColumnTuple::scatter(ColumnIndex num_columns, const Selector & selector) const
@ -188,7 +188,7 @@ Columns ColumnTuple::scatter(ColumnIndex num_columns, const Selector & selector)
Columns new_columns(tuple_size);
for (size_t tuple_element_idx = 0; tuple_element_idx < tuple_size; ++tuple_element_idx)
new_columns[tuple_element_idx] = scattered_tuple_elements[tuple_element_idx][scattered_idx];
res[scattered_idx] = std::make_shared<ColumnTuple>(new_columns);
res[scattered_idx] = ColumnTuple::create(new_columns);
}
return res;

View File

@ -243,6 +243,15 @@ public:
using ColumnCallback = std::function<void(Ptr&)>;
virtual void forEachSubcolumn(ColumnCallback) {}
MutablePtr mutate() const
{
MutablePtr res = IColumn::mutate();
res->forEachSubcolumn([](Ptr & subcolumn) { subcolumn = subcolumn->mutate(); });
return res;
}
/** Some columns can contain another columns inside.
* So, we have a tree of columns. But not all combinations are possible.
* There are the following rules:

View File

@ -110,7 +110,12 @@ public:
if (this->use_count() > 1)
return derived()->clone();
else
return const_cast<COWPtr*>(this)->getPtr();
return assumeMutable();
}
MutablePtr assumeMutable() const
{
return const_cast<COWPtr*>(this)->getPtr();
}
};
@ -154,3 +159,24 @@ public:
Base * clone() const override { return new Derived(*derived()); }
};
/** Compositions.
*
* Sometimes your objects contain another objects, and you have tree-like structure.
* And you want non-const methods of your object to also modify your subobjects.
*
* There are the following possible solutions:
*
* 1. Store subobjects as immutable ptrs. Call mutate method of subobjects inside non-const methods of your objects; modify them and assign back.
* Drawback: additional checks inside methods: CPU overhead on atomic ops.
*
* 2. Store subobjects as mutable ptrs. Subobjects cannot be shared in another objects.
* Drawback: it's not possible to share subobjects.
*
* 3. Store subobjects as immutable ptrs. Implement copy-constructor to do shallow copy.
* But reimplement 'mutate' method, so it will call 'mutate' of all subobjects (do deep mutate).
* It will guarantee, that mutable object have all subobjects unshared.
* From non-const method, you can modify subobjects with 'assumeMutable' method.
* Drawback: it's more complex than other solutions.
*/

View File

@ -62,7 +62,7 @@ void AddingDefaultBlockOutputStream::write(const DB::Block & block)
UInt64 nested_rows = rows ? get<UInt64>((*offsets_column)[rows - 1]) : 0;
ColumnPtr nested_column = nested_type->createColumnConst(nested_rows, nested_type->getDefault())->convertToFullColumnIfConst();
column_to_add.column = std::make_shared<ColumnArray>(nested_column, offsets_column);
column_to_add.column = ColumnArray::create(nested_column, offsets_column);
}
else
{

View File

@ -66,10 +66,10 @@ Block NullableAdapterBlockInputStream::readImpl()
}
case TO_NULLABLE:
{
auto null_map = std::make_shared<ColumnUInt8>(elem.column->size(), 0);
auto null_map = ColumnUInt8::create(elem.column->size(), 0);
res.insert({
std::make_shared<ColumnNullable>(elem.column, null_map),
ColumnNullable::create(elem.column, null_map),
std::make_shared<DataTypeNullable>(elem.type),
rename[i].value_or(elem.name)
});

View File

@ -273,7 +273,7 @@ Block SummingSortedBlockInputStream::readImpl()
for (size_t i = 0; i < tuple_size; ++i)
tuple_columns[i] = merged_block.safeGetByPosition(desc.column_numbers[i]).column;
desc.merged_column = std::make_shared<ColumnTuple>(tuple_columns);
desc.merged_column = ColumnTuple::create(tuple_columns);
}
else
desc.merged_column = merged_block.safeGetByPosition(desc.column_numbers[0]).column;

View File

@ -197,7 +197,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co
if (init)
{
function = column->getAggregateFunction().get();
auto target = std::make_shared<ColumnAggregateFunction>(column->getAggregateFunction(), Arenas(1, arena));
auto target = ColumnAggregateFunction::create(column->getAggregateFunction(), Arenas(1, arena));
totals.insert(ColumnWithTypeAndName(target, current.type, current.name));
data = arena->alloc(function->sizeOfData());

View File

@ -55,7 +55,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = std::make_shared<DataTypeUInt32>();
auto x = std::make_shared<ColumnUInt32>();
auto x = ColumnUInt32::create();
column_x.column = x;
auto & vec_x = x->getData();
@ -70,7 +70,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = std::make_shared<DataTypeString>();
column_s1.column = std::make_shared<ColumnString>();
column_s1.column = ColumnString::create();
size_t chunk = n / 4;
for (size_t i = 0; i < n; ++i)
@ -81,7 +81,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = std::make_shared<DataTypeString>();
column_s2.column = std::make_shared<ColumnString>();
column_s2.column = ColumnString::create();
for (size_t i = 0; i < n; ++i)
column_s2.column->insert(std::string(strings[i % 3]));
@ -96,7 +96,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_k;
column_k.name = "testMap.k";
column_k.type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt16>());
column_k.column = std::make_shared<ColumnArray>(std::make_shared<ColumnUInt16>());
column_k.column = ColumnArray::create(ColumnUInt16::create());
for (UInt64 i = 0; i < n; ++i)
{
@ -110,7 +110,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_v;
column_v.name = "testMap.v";
column_v.type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt64>());
column_v.column = std::make_shared<ColumnArray>(std::make_shared<ColumnUInt64>());
column_v.column = ColumnArray::create(ColumnUInt64::create());
for (UInt64 i = 0; i < n; ++i)
{
@ -126,7 +126,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_v2;
column_v2.name = "testMap.v2";
column_v2.type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt64>());
column_v2.column = std::make_shared<ColumnArray>(std::make_shared<ColumnUInt64>());
column_v2.column = ColumnArray::create(ColumnUInt64::create());
for (UInt64 i = 0; i < n; ++i)
{
@ -143,7 +143,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_kid;
column_kid.name = "testMap.kID";
column_kid.type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt8>());
column_kid.column = std::make_shared<ColumnArray>(std::make_shared<ColumnUInt8>());
column_kid.column = ColumnArray::create(ColumnUInt8::create());
for (UInt64 i = 0; i < n; ++i)
{

View File

@ -30,7 +30,7 @@ try
ColumnWithTypeAndName column1;
column1.name = "Sign";
column1.type = std::make_shared<DataTypeInt8>();
column1.column = std::make_shared<ColumnInt8>();
column1.column = ColumnInt8::create();
column1.column->insert(DB::Int64(1));
column1.column->insert(DB::Int64(-1));
block1.insert(column1);
@ -38,7 +38,7 @@ try
ColumnWithTypeAndName column2;
column2.name = "CounterID";
column2.type = std::make_shared<DataTypeUInt32>();
column2.column = std::make_shared<ColumnUInt32>();
column2.column = ColumnUInt32::create();
column2.column->insert(DB::UInt64(123));
column2.column->insert(DB::UInt64(123));
block1.insert(column2);
@ -50,7 +50,7 @@ try
ColumnWithTypeAndName column1;
column1.name = "Sign";
column1.type = std::make_shared<DataTypeInt8>();
column1.column = std::make_shared<ColumnInt8>();
column1.column = ColumnInt8::create();
column1.column->insert(DB::Int64(1));
column1.column->insert(DB::Int64(1));
block2.insert(column1);
@ -58,7 +58,7 @@ try
ColumnWithTypeAndName column2;
column2.name = "CounterID";
column2.type = std::make_shared<DataTypeUInt32>();
column2.column = std::make_shared<ColumnUInt32>();
column2.column = ColumnUInt32::create();
column2.column->insert(DB::UInt64(123));
column2.column->insert(DB::UInt64(456));
block2.insert(column2);

View File

@ -140,10 +140,10 @@ void test2()
const auto & col = block.safeGetByPosition(0);
auto extra_info = union_stream.getBlockExtraInfo();
ColumnPtr host_name_column = std::make_shared<ColumnString>();
ColumnPtr host_address_column = std::make_shared<ColumnString>();
ColumnPtr port_column = std::make_shared<ColumnUInt16>();
ColumnPtr user_column = std::make_shared<ColumnString>();
ColumnPtr host_name_column = ColumnString::create();
ColumnPtr host_address_column = ColumnString::create();
ColumnPtr port_column = ColumnUInt16::create();
ColumnPtr user_column = ColumnString::create();
size_t row_count = block.rows();
for (size_t i = 0; i < row_count; ++i)

View File

@ -245,7 +245,7 @@ void DataTypeAggregateFunction::deserializeTextCSV(IColumn & column, ReadBuffer
ColumnPtr DataTypeAggregateFunction::createColumn() const
{
return std::make_shared<ColumnAggregateFunction>(function);
return ColumnAggregateFunction::create(function);
}

View File

@ -421,7 +421,7 @@ void DataTypeArray::deserializeTextCSV(IColumn & column, ReadBuffer & istr, cons
ColumnPtr DataTypeArray::createColumn() const
{
return std::make_shared<ColumnArray>(nested->createColumn());
return ColumnArray::create(nested->createColumn());
}

View File

@ -110,7 +110,7 @@ public:
void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, const size_t offset, size_t limit) const override;
void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, const size_t limit, const double avg_value_size_hint) const override;
ColumnPtr createColumn() const override { return std::make_shared<ColumnType>(); }
ColumnPtr createColumn() const override { return ColumnType::create(); }
Field getDefault() const override;
void insertDefaultInto(IColumn & column) const override;

View File

@ -202,7 +202,7 @@ void DataTypeFixedString::deserializeTextCSV(IColumn & column, ReadBuffer & istr
ColumnPtr DataTypeFixedString::createColumn() const
{
return std::make_shared<ColumnFixedString>(n);
return ColumnFixedString::create(n);
}

View File

@ -11,7 +11,7 @@ namespace DB
ColumnPtr DataTypeNothing::createColumn() const
{
return std::make_shared<ColumnNothing>(0);
return ColumnNothing::create(0);
}
void DataTypeNothing::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const

View File

@ -277,7 +277,7 @@ void DataTypeNullable::serializeTextXML(const IColumn & column, size_t row_num,
ColumnPtr DataTypeNullable::createColumn() const
{
return std::make_shared<ColumnNullable>(nested_data_type->createColumn(), std::make_shared<ColumnUInt8>());
return ColumnNullable::create(nested_data_type->createColumn(), ColumnUInt8::create());
}

View File

@ -236,7 +236,7 @@ void DataTypeNumberBase<T>::deserializeBinaryBulk(IColumn & column, ReadBuffer &
template <typename T>
ColumnPtr DataTypeNumberBase<T>::createColumn() const
{
return std::make_shared<ColumnVector<T>>();
return ColumnVector<T>::create();
}
template <typename T>

View File

@ -293,7 +293,7 @@ void DataTypeString::deserializeTextCSV(IColumn & column, ReadBuffer & istr, con
ColumnPtr DataTypeString::createColumn() const
{
return std::make_shared<ColumnString>();
return ColumnString::create();
}

View File

@ -279,7 +279,7 @@ ColumnPtr DataTypeTuple::createColumn() const
Columns tuple_columns(size);
for (size_t i = 0; i < size; ++i)
tuple_columns[i] = elems[i]->createColumn();
return std::make_shared<ColumnTuple>(tuple_columns);
return ColumnTuple::create(tuple_columns);
}
Field DataTypeTuple::getDefault() const

View File

@ -42,7 +42,7 @@ ColumnPtr IDataType::createColumnConst(size_t size, const Field & field) const
{
ColumnPtr column = createColumn();
column->insert(field);
return std::make_shared<ColumnConst>(column, size);
return ColumnConst::create(column, size);
}

View File

@ -23,7 +23,7 @@ try
DataTypeString data_type;
{
std::shared_ptr<ColumnString> column = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> column = ColumnString::create();
ColumnString::Chars_t & data = column->getChars();
ColumnString::Offsets_t & offsets = column->getOffsets();
@ -45,7 +45,7 @@ try
}
{
std::shared_ptr<ColumnString> column = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> column = ColumnString::create();
ReadBufferFromFile in_buf("test");

View File

@ -12,7 +12,7 @@ int main(int, char **)
{
using namespace DB;
std::shared_ptr<ColumnUInt64> column = std::make_shared<ColumnUInt64>();
std::shared_ptr<ColumnUInt64> column = ColumnUInt64::create();
ColumnUInt64::Container_t & vec = column->getData();
DataTypeUInt64 data_type;

View File

@ -219,7 +219,7 @@ private:
if (size == 0)
return nullptr;
size_t column_size = columns[offset]->size();
auto data_column = std::make_shared<ColumnVector<T>>(size * column_size);
auto data_column = ColumnVector<T>::create(size * column_size);
T* data = data_column->getData().data();
for (size_t i = 0; i < size; ++i)
{
@ -328,7 +328,7 @@ private:
std::string error_msg = "Error occurred while applying CatBoost model: ";
size_t column_size = columns.front()->size();
auto result= std::make_shared<ColumnFloat64>(column_size);
auto result= ColumnFloat64::create(column_size);
auto result_buf = result->getData().data();
/// Prepare float features.

View File

@ -342,7 +342,7 @@ ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromStringAt
const Columns & keys, const DataTypes & data_types,
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const
{
auto column_string = std::make_shared<ColumnString>();
auto column_string = ColumnString::create();
auto ptr = column_string.get();
callGetter(getter, ids, keys, data_types, ptr, attribute, dictionary);
return column_string;
@ -351,7 +351,7 @@ ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromStringAt
template <typename DictionaryType, typename Key>
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromIds(const PaddedPODArray<Key>& ids) const
{
auto column_vector = std::make_shared<ColumnVector<UInt64>>();
auto column_vector = ColumnVector<UInt64>::create();
column_vector->getData().reserve(ids.size());
for (UInt64 id : ids)
{
@ -368,7 +368,7 @@ void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns(
for (const DictionaryAttribute & attribute : *dictionary_structure.key)
{
#define ADD_COLUMN(TYPE) columns.push_back( \
ColumnWithTypeAndName(std::make_shared<ColumnVector<TYPE>>(), attribute.type, attribute.name))
ColumnWithTypeAndName(ColumnVector<TYPE>::create(), attribute.type, attribute.name))
switch (attribute.underlying_type)
{
case AttributeUnderlyingType::UInt8:
@ -406,7 +406,7 @@ void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns(
break;
case AttributeUnderlyingType::String:
{
columns.push_back(ColumnWithTypeAndName(std::make_shared<ColumnString>(), attribute.type, attribute.name));
columns.push_back(ColumnWithTypeAndName(ColumnString::create(), attribute.type, attribute.name));
break;
}
}

View File

@ -54,7 +54,7 @@ Block createSampleBlock(const DictionaryStructure & dict_struct)
if (dict_struct.id)
block.insert(ColumnWithTypeAndName{
std::make_shared<ColumnUInt64>(1), std::make_shared<DataTypeUInt64>(), dict_struct.id->name});
ColumnUInt64::create(1), std::make_shared<DataTypeUInt64>(), dict_struct.id->name});
if (dict_struct.key)
{
@ -70,7 +70,7 @@ Block createSampleBlock(const DictionaryStructure & dict_struct)
if (dict_struct.range_min)
for (const auto & attribute : { dict_struct.range_min, dict_struct.range_max })
block.insert(ColumnWithTypeAndName{
std::make_shared<ColumnUInt16>(1), std::make_shared<DataTypeDate>(), attribute->name});
ColumnUInt16::create(1), std::make_shared<DataTypeDate>(), attribute->name});
for (const auto & attribute : dict_struct.attributes)
{

View File

@ -14,7 +14,7 @@ namespace DB
/// For simple key
void formatIDs(BlockOutputStreamPtr & out, const std::vector<UInt64> & ids)
{
auto column = std::make_shared<ColumnUInt64>(ids.size());
auto column = ColumnUInt64::create(ids.size());
memcpy(column->getData().data(), ids.data(), ids.size() * sizeof(ids.front()));
Block block{{ std::move(column), std::make_shared<DataTypeUInt64>(), "id" }};

View File

@ -179,7 +179,7 @@ LocalDateTime MySQLDictionarySource::getLastModification() const
std::string MySQLDictionarySource::doInvalidateQuery(const std::string & request) const
{
Block sample_block;
ColumnPtr column(std::make_shared<ColumnString>());
ColumnPtr column(ColumnString::create());
sample_block.insert(ColumnWithTypeAndName(column, std::make_shared<DataTypeString>(), "Sample Block"));
MySQLBlockInputStream block_input_stream(pool.Get(), request, sample_block, 1);
return readInvalidateQuery(block_input_stream);

View File

@ -119,7 +119,7 @@ bool ODBCDictionarySource::isModified() const
std::string ODBCDictionarySource::doInvalidateQuery(const std::string & request) const
{
Block sample_block;
ColumnPtr column(std::make_shared<ColumnString>());
ColumnPtr column(ColumnString::create());
sample_block.insert(ColumnWithTypeAndName(column, std::make_shared<DataTypeString>(), "Sample Block"));
ODBCBlockInputStream block_input_stream(pool->get(), request, sample_block, 1);
return readInvalidateQuery(block_input_stream);

View File

@ -604,8 +604,8 @@ void TrieDictionary::trieTraverse(const btrie_t * tree, Getter && getter) const
Columns TrieDictionary::getKeyColumns() const
{
auto ip_column = std::make_shared<ColumnFixedString>(IPV6_BINARY_LENGTH);
auto mask_column = std::make_shared<ColumnVector<UInt8>>();
auto ip_column = ColumnFixedString::create(IPV6_BINARY_LENGTH);
auto mask_column = ColumnVector<UInt8>::create();
#if defined(__SIZEOF_INT128__)
auto getter = [& ip_column, & mask_column](__uint128_t ip, size_t mask) {
@ -636,7 +636,7 @@ BlockInputStreamPtr TrieDictionary::getBlockInputStream(const Names & column_nam
};
auto getView = [](const Columns& columns, const std::vector<DictionaryAttribute>& attributes)
{
auto column = std::make_shared<ColumnString>();
auto column = ColumnString::create();
auto ip_column = std::static_pointer_cast<ColumnFixedString>(columns.front());
auto mask_column = std::static_pointer_cast<ColumnVector<UInt8>>(columns.back());
char buffer[48];

View File

@ -35,7 +35,7 @@ Columns convertConstTupleToConstantElements(const ColumnConst & column)
Columns res(tuple_size);
for (size_t i = 0; i < tuple_size; ++i)
res[i] = std::make_shared<ColumnConst>(src_tuple_columns[i], rows);
res[i] = ColumnConst::create(src_tuple_columns[i], rows);
return res;
}
@ -80,7 +80,7 @@ Block createBlockWithNestedColumns(const Block & block, ColumnNumbers args)
const auto & nested_col = static_cast<const ColumnNullable &>(
static_cast<const ColumnConst &>(*col.column).getDataColumn()).getNestedColumn();
res.insert(i, { std::make_shared<ColumnConst>(nested_col, rows), nested_type, col.name});
res.insert(i, { ColumnConst::create(nested_col, rows), nested_type, col.name});
is_inserted = true;
}
}

View File

@ -647,7 +647,7 @@ private:
{
if (auto col_right = checkAndGetColumn<ColumnVector<T1>>(block.getByPosition(arguments[1]).column.get()))
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
auto & vec_res = col_res->getData();
@ -658,7 +658,7 @@ private:
}
else if (auto col_right = checkAndGetColumnConst<ColumnVector<T1>>(block.getByPosition(arguments[1]).column.get()))
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
auto & vec_res = col_res->getData();
@ -677,7 +677,7 @@ private:
{
if (auto col_right = checkAndGetColumn<ColumnVector<T1>>(block.getByPosition(arguments[1]).column.get()))
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
auto & vec_res = col_res->getData();
@ -916,7 +916,7 @@ private:
{
using ResultType = typename Op<T0>::ResultType;
std::shared_ptr<ColumnVector<ResultType>> col_res = std::make_shared<ColumnVector<ResultType>>();
std::shared_ptr<ColumnVector<ResultType>> col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -1290,7 +1290,7 @@ private:
const auto mask = createConstMask<T>(block, arguments, is_const);
const auto & val = value_col->getData();
const auto out_col = std::make_shared<ColumnVector<UInt8>>(size);
const auto out_col = ColumnVector<UInt8>::create(size);
auto & out = out_col->getData();
if (is_const)
@ -1323,7 +1323,7 @@ private:
else
{
const auto mask = createMask<T>(size, block, arguments);
const auto out_col = std::make_shared<ColumnVector<UInt8>>(size);
const auto out_col = ColumnVector<UInt8>::create(size);
auto & out = out_col->getData();

View File

@ -84,7 +84,7 @@ void FunctionArray::executeImpl(Block & block, const ColumnNumbers & arguments,
/** Create and fill the result array.
*/
auto out = std::make_shared<ColumnArray>(elem_type->createColumn());
auto out = ColumnArray::create(elem_type->createColumn());
IColumn & out_data = out->getData();
IColumn::Offsets_t & out_offsets = out->getOffsets();
@ -123,7 +123,7 @@ public:
void initSink(size_t size)
{
auto sink = std::make_shared<ColumnUInt8>(size);
auto sink = ColumnUInt8::create(size);
sink_null_map = sink->getData().data();
sink_null_map_holder = sink;
}
@ -457,7 +457,7 @@ bool FunctionArrayElement::executeNumberConst(Block & block, const ColumnNumbers
if (!col_nested)
return false;
auto col_res = std::make_shared<ColumnVector<DataType>>();
auto col_res = ColumnVector<DataType>::create();
block.getByPosition(result).column = col_res;
if (index.getType() == Field::Types::UInt64)
@ -486,7 +486,7 @@ bool FunctionArrayElement::executeNumber(Block & block, const ColumnNumbers & ar
if (!col_nested)
return false;
auto col_res = std::make_shared<ColumnVector<DataType>>();
auto col_res = ColumnVector<DataType>::create();
block.getByPosition(result).column = col_res;
ArrayElementNumImpl<DataType>::template vector<IndexType>(
@ -508,7 +508,7 @@ bool FunctionArrayElement::executeStringConst(Block & block, const ColumnNumbers
if (!col_nested)
return false;
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
if (index.getType() == Field::Types::UInt64)
@ -549,7 +549,7 @@ bool FunctionArrayElement::executeString(Block & block, const ColumnNumbers & ar
if (!col_nested)
return false;
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ArrayElementStringImpl::vector<IndexType>(
@ -721,7 +721,7 @@ bool FunctionArrayElement::executeTuple(Block & block, const ColumnNumbers & arg
for (size_t i = 0; i < tuple_size; ++i)
{
ColumnWithTypeAndName array_of_tuple_section;
array_of_tuple_section.column = std::make_shared<ColumnArray>(tuple_columns[i], col_array->getOffsetsColumn());
array_of_tuple_section.column = ColumnArray::create(tuple_columns[i], col_array->getOffsetsColumn());
array_of_tuple_section.type = std::make_shared<DataTypeArray>(tuple_types[i]);
block_of_temporary_results.insert(array_of_tuple_section);
@ -735,7 +735,7 @@ bool FunctionArrayElement::executeTuple(Block & block, const ColumnNumbers & arg
result_tuple_columns.emplace_back(std::move(block_of_temporary_results.getByPosition(i * 2 + 2).column));
}
block.getByPosition(result).column = std::make_shared<ColumnTuple>(result_tuple_columns);
block.getByPosition(result).column = ColumnTuple::create(result_tuple_columns);
return true;
}
@ -801,7 +801,7 @@ void FunctionArrayElement::executeImpl(Block & block, const ColumnNumbers & argu
source_block =
{
{
std::make_shared<ColumnArray>(nested_col, col_array->getOffsetsColumn()),
ColumnArray::create(nested_col, col_array->getOffsetsColumn()),
std::make_shared<DataTypeArray>(input_type),
""
},
@ -824,7 +824,7 @@ void FunctionArrayElement::executeImpl(Block & block, const ColumnNumbers & argu
source_block =
{
{
std::make_shared<ColumnConst>(std::make_shared<ColumnArray>(nested_col, col_const_array->getOffsetsColumn()), block.rows()),
ColumnConst::create(ColumnArray::create(nested_col, col_const_array->getOffsetsColumn()), block.rows()),
std::make_shared<DataTypeArray>(input_type),
""
},
@ -844,7 +844,7 @@ void FunctionArrayElement::executeImpl(Block & block, const ColumnNumbers & argu
/// Store the result.
const ColumnWithTypeAndName & source_col = source_block.getByPosition(2);
ColumnWithTypeAndName & dest_col = block.getByPosition(result);
dest_col.column = std::make_shared<ColumnNullable>(source_col.column, builder.getNullMap());
dest_col.column = ColumnNullable::create(source_col.column, builder.getNullMap());
}
}
@ -923,8 +923,8 @@ void FunctionArrayEnumerate::executeImpl(Block & block, const ColumnNumbers & ar
{
const ColumnArray::Offsets_t & offsets = array->getOffsets();
auto res_nested = std::make_shared<ColumnUInt32>();
auto res_array = std::make_shared<ColumnArray>(res_nested, array->getOffsetsColumn());
auto res_nested = ColumnUInt32::create();
auto res_array = ColumnArray::create(res_nested, array->getOffsetsColumn());
block.getByPosition(result).column = res_array;
ColumnUInt32::Container_t & res_values = res_nested->getData();
@ -1026,7 +1026,7 @@ void FunctionArrayUniq::executeImpl(Block & block, const ColumnNumbers & argumen
const ColumnArray * first_array = static_cast<const ColumnArray *>(array_columns[0].get());
const IColumn * first_null_map = null_maps[0];
auto res = std::make_shared<ColumnUInt32>();
auto res = ColumnUInt32::create();
block.getByPosition(result).column = res;
ColumnUInt32::Container_t & res_values = res->getData();
@ -1332,8 +1332,8 @@ void FunctionArrayEnumerateUniq::executeImpl(Block & block, const ColumnNumbers
const ColumnArray * first_array = checkAndGetColumn<ColumnArray>(array_columns[0].get());
const IColumn * first_null_map = null_maps[0];
auto res_nested = std::make_shared<ColumnUInt32>();
auto res_array = std::make_shared<ColumnArray>(res_nested, first_array->getOffsetsColumn());
auto res_nested = ColumnUInt32::create();
auto res_array = ColumnArray::create(res_nested, first_array->getOffsetsColumn());
block.getByPosition(result).column = res_array;
ColumnUInt32::Container_t & res_values = res_nested->getData();
@ -1975,8 +1975,8 @@ bool FunctionRange::executeInternal(Block & block, const IColumn * arg, const si
" array elements, which is greater than the allowed maximum of " + std::to_string(max_elements),
ErrorCodes::ARGUMENT_OUT_OF_BOUND};
const auto data_col = std::make_shared<ColumnVector<T>>(total_values);
const auto out = std::make_shared<ColumnArray>(
const auto data_col = ColumnVector<T>::create(total_values);
const auto out = ColumnArray::create(
data_col,
std::make_shared<ColumnArray::ColumnOffsets_t>(in->size()));
block.getByPosition(result).column = out;
@ -2011,8 +2011,8 @@ bool FunctionRange::executeInternal(Block & block, const IColumn * arg, const si
" array elements, which is greater than the allowed maximum of " + toString(max_elements),
ErrorCodes::ARGUMENT_OUT_OF_BOUND};
const auto data_col = std::make_shared<ColumnVector<T>>(total_values);
const auto out = std::make_shared<ColumnArray>(
const auto data_col = ColumnVector<T>::create(total_values);
const auto out = ColumnArray::create(
data_col,
std::make_shared<ColumnArray::ColumnOffsets_t>(in->size()));
block.getByPosition(result).column = out;
@ -2669,7 +2669,7 @@ void FunctionArraySlice::executeImpl(Block & block, const ColumnNumbers & argume
sliceFromLeftConstantOffsetBounded(*source, *sink, 0, length_column->getInt(0));
else
{
auto const_offset_column = std::make_shared<ColumnConst>(std::make_shared<ColumnInt8>(1, 1), size);
auto const_offset_column = ColumnConst::create(ColumnInt8::create(1, 1), size);
sliceDynamicOffsetBounded(*source, *sink, *const_offset_column, *length_column);
}
}

View File

@ -1106,7 +1106,7 @@ public:
const auto & nested_col = nullable_col.getNestedColumn();
auto & data = source_block.getByPosition(0);
data.column = std::make_shared<ColumnArray>(nested_col, col_array->getOffsetsColumn());
data.column = ColumnArray::create(nested_col, col_array->getOffsetsColumn());
data.type = static_cast<const DataTypeNullable &>(*block.getByPosition(arguments[0]).type).getNestedType();
auto & null_map = source_block.getByPosition(2);
@ -1301,7 +1301,7 @@ private:
{
using UnderlyingColumnType = typename TypeToColumnType<typename DataType::FieldType>::ColumnType;
block.getByPosition(result).column = std::make_shared<ColumnArray>(
block.getByPosition(result).column = ColumnArray::create(
std::make_shared<UnderlyingColumnType>(),
std::make_shared<ColumnArray::ColumnOffsets_t>(block.rows(), 0));
}

View File

@ -198,7 +198,7 @@ public:
if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(arg_from.column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
convert(charset_from, charset_to, col_from->getChars(), col_from->getOffsets(), col_to->getChars(), col_to->getOffsets());
res.column = col_to;
}

View File

@ -103,7 +103,7 @@ public:
const auto size = col_in->size();
const auto & vec_in = col_in->getChars();
auto col_res = std::make_shared<ColumnString>();
auto col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -211,7 +211,7 @@ public:
const auto size = col_in->size();
const auto & vec_in = col_in->getChars();
auto col_res = std::make_shared<ColumnString>();
auto col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -418,7 +418,7 @@ public:
if (const auto col_in = checkAndGetColumn<ColumnString>(column.get()))
{
const auto col_res = std::make_shared<ColumnFixedString>(ipv6_bytes_length);
const auto col_res = ColumnFixedString::create(ipv6_bytes_length);
block.getByPosition(result).column = col_res;
auto & vec_res = col_res->getChars();
@ -533,7 +533,7 @@ public:
{
const ColumnUInt32::Container_t & vec_in = col->getData();
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -613,7 +613,7 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
auto col_res = std::make_shared<ColumnUInt32>();
auto col_res = ColumnUInt32::create();
block.getByPosition(result).column = col_res;
ColumnUInt32::Container_t & vec_res = col_res->getData();
@ -666,7 +666,7 @@ public:
if (const auto col_in = typeid_cast<const ColumnUInt32 *>(column.get()))
{
const auto col_res = std::make_shared<ColumnFixedString>(ipv6_bytes_length);
const auto col_res = ColumnFixedString::create(ipv6_bytes_length);
block.getByPosition(result).column = col_res;
auto & vec_res = col_res->getChars();
@ -744,7 +744,7 @@ public:
{
const ColumnUInt64::Container_t & vec_in = col->getData();
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -851,7 +851,7 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
auto col_res = std::make_shared<ColumnUInt64>();
auto col_res = ColumnUInt64::create();
block.getByPosition(result).column = col_res;
ColumnUInt64::Container_t & vec_res = col_res->getData();
@ -928,7 +928,7 @@ public:
const auto size = col_in->size();
const auto & vec_in = col_in->getChars();
auto col_res = std::make_shared<ColumnString>();
auto col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -1023,7 +1023,7 @@ public:
const auto & offsets_in = col_in->getOffsets();
const size_t size = offsets_in.size();
auto col_res = std::make_shared<ColumnFixedString>(uuid_bytes_length);
auto col_res = ColumnFixedString::create(uuid_bytes_length);
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -1059,7 +1059,7 @@ public:
const auto size = col_in->size();
const auto & vec_in = col_in->getChars();
auto col_res = std::make_shared<ColumnFixedString>(uuid_bytes_length);
auto col_res = ColumnFixedString::create(uuid_bytes_length);
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();
@ -1102,7 +1102,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & /*arguments*/, size_t result) override
{
auto col_to = std::make_shared<ColumnVector<UInt128>>();
auto col_to = ColumnVector<UInt128>::create();
block.safeGetByPosition(result).column = col_to;
typename ColumnVector<UInt128>::Container_t & vec_to = col_to->getData();
@ -1181,7 +1181,7 @@ public:
if (col_vec)
{
auto col_str = std::make_shared<ColumnString>();
auto col_str = ColumnString::create();
col_res = col_str;
ColumnString::Chars_t & out_vec = col_str->getChars();
ColumnString::Offsets_t & out_offsets = col_str->getOffsets();
@ -1235,7 +1235,7 @@ public:
if (col_str_in)
{
auto col_str = std::make_shared<ColumnString>();
auto col_str = ColumnString::create();
col_res = col_str;
ColumnString::Chars_t & out_vec = col_str->getChars();
ColumnString::Offsets_t & out_offsets = col_str->getOffsets();
@ -1279,7 +1279,7 @@ public:
if (col_fstr_in)
{
auto col_str = std::make_shared<ColumnString>();
auto col_str = ColumnString::create();
col_res = col_str;
@ -1392,7 +1392,7 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & out_vec = col_res->getChars();
@ -1462,8 +1462,8 @@ public:
{
if (const ColumnVector<T> * col_from = checkAndGetColumn<ColumnVector<T>>(column))
{
auto col_values = std::make_shared<ColumnVector<T>>();
auto col_array = std::make_shared<ColumnArray>(col_values);
auto col_values = ColumnVector<T>::create();
auto col_array = ColumnArray::create(col_values);
out_column = col_array;
ColumnArray::Offsets_t & res_offsets = col_array->getOffsets();
@ -1546,7 +1546,7 @@ public:
if (col_str_in)
{
auto col_str = std::make_shared<ColumnString>();
auto col_str = ColumnString::create();
col_res = col_str;
ColumnString::Chars_t & out_vec = col_str->getChars();
ColumnString::Offsets_t & out_offsets = col_str->getOffsets();
@ -1593,7 +1593,7 @@ public:
if (col_fstr_in)
{
auto col_str = std::make_shared<ColumnString>();
auto col_str = ColumnString::create();
col_res = col_str;
ColumnString::Chars_t & out_vec = col_str->getChars();

View File

@ -583,7 +583,7 @@ private:
{
if (const ColumnVector<T1> * col_right = checkAndGetColumn<ColumnVector<T1>>(col_right_untyped))
{
std::shared_ptr<ColumnUInt8> col_res = std::make_shared<ColumnUInt8>();
std::shared_ptr<ColumnUInt8> col_res = ColumnUInt8::create();
block.getByPosition(result).column = col_res;
ColumnUInt8::Container_t & vec_res = col_res->getData();
@ -594,7 +594,7 @@ private:
}
else if (auto col_right = checkAndGetColumnConst<ColumnVector<T1>>(col_right_untyped))
{
std::shared_ptr<ColumnUInt8> col_res = std::make_shared<ColumnUInt8>();
std::shared_ptr<ColumnUInt8> col_res = ColumnUInt8::create();
block.getByPosition(result).column = col_res;
ColumnUInt8::Container_t & vec_res = col_res->getData();
@ -612,7 +612,7 @@ private:
{
if (const ColumnVector<T1> * col_right = checkAndGetColumn<ColumnVector<T1>>(col_right_untyped))
{
std::shared_ptr<ColumnUInt8> col_res = std::make_shared<ColumnUInt8>();
std::shared_ptr<ColumnUInt8> col_res = ColumnUInt8::create();
block.getByPosition(result).column = col_res;
ColumnUInt8::Container_t & vec_res = col_res->getData();
@ -694,7 +694,7 @@ private:
using StringImpl = StringComparisonImpl<Op<int, int>>;
auto c_res = std::make_shared<ColumnUInt8>();
auto c_res = ColumnUInt8::create();
block.getByPosition(result).column = c_res;
ColumnUInt8::Container_t & vec_res = c_res->getData();
vec_res.resize(c0->size());
@ -986,7 +986,7 @@ private:
bool c0_const = c0->isColumnConst();
bool c1_const = c1->isColumnConst();
auto c_res = std::make_shared<ColumnUInt8>();
auto c_res = ColumnUInt8::create();
block.getByPosition(result).column = c_res;
ColumnUInt8::Container_t & vec_res = c_res->getData();
vec_res.resize(c0->size());

View File

@ -36,7 +36,7 @@ struct NumIfImpl
private:
static PaddedPODArray<ResultType> & result_vector(Block & block, size_t result, size_t size)
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -422,7 +422,7 @@ private:
&& (col_else || col_else_const || col_else_fixed || col_else_const_fixed))
{
/// The result is String.
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
auto sink = StringSink(*col_res, rows);
@ -549,7 +549,7 @@ private:
/// temporary_block is: cond, res_0, res_1, res_2...
block.getByPosition(result).column = std::make_shared<ColumnTuple>(tuple_columns);
block.getByPosition(result).column = ColumnTuple::create(tuple_columns);
return true;
}
@ -590,7 +590,7 @@ private:
}
else
{
result_column = std::make_shared<ColumnNullable>(
result_column = ColumnNullable::create(
materializeColumnIfConst(result_column), static_cast<const ColumnNullable &>(*arg_cond.column).getNullMapColumn());
}
@ -612,8 +612,8 @@ private:
if (column->isColumnNullable())
return column;
return std::make_shared<ColumnNullable>(
materializeColumnIfConst(column), std::make_shared<ColumnUInt8>(column->size(), 0));
return ColumnNullable::create(
materializeColumnIfConst(column), ColumnUInt8::create(column->size(), 0));
}
static const ColumnPtr getNestedColumn(const ColumnPtr & column)
@ -698,7 +698,7 @@ private:
result_nested_column = temporary_block.getByPosition(3).column;
}
block.getByPosition(result).column = std::make_shared<ColumnNullable>(
block.getByPosition(result).column = ColumnNullable::create(
materializeColumnIfConst(result_nested_column), materializeColumnIfConst(result_null_mask));
return true;
}
@ -737,7 +737,7 @@ private:
}
else
{
block.getByPosition(result).column = std::make_shared<ColumnNullable>(
block.getByPosition(result).column = ColumnNullable::create(
materializeColumnIfConst(arg_else.column), arg_cond.column->clone());
}
}
@ -762,7 +762,7 @@ private:
size_t size = block.rows();
auto & null_map_data = cond_col->getData();
auto negated_null_map = std::make_shared<ColumnUInt8>();
auto negated_null_map = ColumnUInt8::create();
auto & negated_null_map_data = negated_null_map->getData();
negated_null_map_data.resize(size);
@ -777,7 +777,7 @@ private:
}
else
{
block.getByPosition(result).column = std::make_shared<ColumnNullable>(
block.getByPosition(result).column = ColumnNullable::create(
materializeColumnIfConst(arg_then.column), negated_null_map);
}
}

View File

@ -73,7 +73,7 @@ struct ConvertImpl
if (const ColumnVector<FromFieldType> * col_from
= checkAndGetColumn<ColumnVector<FromFieldType>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnVector<ToFieldType>>();
auto col_to = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<FromFieldType>::Container_t & vec_from = col_from->getData();
@ -215,7 +215,7 @@ struct ConvertImpl<FromDataType, typename std::enable_if<!std::is_same<FromDataT
if (const auto col_from = checkAndGetColumn<ColumnVector<FromFieldType>>(col_with_type_and_name.column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<FromFieldType>::Container_t & vec_from = col_from->getData();
@ -262,7 +262,7 @@ struct ConvertImplGenericToString
size_t size = col_from.size();
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
ColumnString::Chars_t & data_to = col_to->getChars();
@ -333,7 +333,7 @@ struct ConvertImpl<typename std::enable_if<!std::is_same<ToDataType, DataTypeStr
if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnVector<ToFieldType>>();
auto col_to = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_to;
typename ColumnVector<ToFieldType>::Container_t & vec_to = col_to->getData();
@ -388,7 +388,7 @@ struct ConvertOrZeroImpl
{
if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnVector<ToFieldType>>();
auto col_to = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_to;
typename ColumnVector<ToFieldType>::Container_t & vec_to = col_to->getData();
@ -502,7 +502,7 @@ struct ConvertImpl<DataTypeFixedString, ToDataType, Name>
if (std::is_same<ToDataType, DataTypeDateTime>::value)
time_zone = &extractTimeZoneFromFunctionArguments(block, arguments, 1);
auto col_to = std::make_shared<ColumnVector<ToFieldType>>();
auto col_to = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_to;
const ColumnFixedString::Chars_t & data_from = col_from->getChars();
@ -545,7 +545,7 @@ struct ConvertImpl<DataTypeFixedString, DataTypeString, Name>
{
if (const ColumnFixedString * col_from = checkAndGetColumn<ColumnFixedString>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const ColumnFixedString::Chars_t & data_from = col_from->getChars();
@ -834,7 +834,7 @@ public:
if (const auto column_string = checkAndGetColumn<ColumnString>(column.get()))
{
const auto column_fixed = std::make_shared<ColumnFixedString>(n);
const auto column_fixed = ColumnFixedString::create(n);
ColumnPtr result_ptr = column_fixed;
auto & out_chars = column_fixed->getChars();
@ -863,7 +863,7 @@ public:
"String too long for type FixedString(" + toString(n) + ")",
ErrorCodes::TOO_LARGE_STRING_SIZE};
const auto column_fixed = std::make_shared<ColumnFixedString>(n);
const auto column_fixed = ColumnFixedString::create(n);
block.getByPosition(result).column = column_fixed;
auto & out_chars = column_fixed->getChars();
@ -1189,7 +1189,7 @@ private:
while (const auto nested_col_array = checkAndGetColumn<ColumnArray>(col_array->getDataPtr().get()))
{
/// create new level of array, copy offsets
res->getDataPtr() = std::make_shared<ColumnArray>(nullptr, nested_col_array->getOffsetsColumn());
res->getDataPtr() = ColumnArray::create(nullptr, nested_col_array->getOffsetsColumn());
res = static_cast<ColumnArray *>(res->getDataPtr().get());
col_array = nested_col_array;
@ -1280,7 +1280,7 @@ private:
for (size_t i = 0; i < tuple_size; ++i)
converted_columns[i] = element_block.getByPosition(tuple_size + i).column;
block.getByPosition(result).column = std::make_shared<ColumnTuple>(converted_columns);
block.getByPosition(result).column = ColumnTuple::create(converted_columns);
};
}
@ -1490,11 +1490,11 @@ private:
{
/// This is a conversion from an ordinary type to a nullable type.
/// So we create a trivial null map.
null_map = std::make_shared<ColumnUInt8>(block.rows(), 0);
null_map = ColumnUInt8::create(block.rows(), 0);
}
const auto & tmp_res = tmp_block.getByPosition(tmp_res_index);
res.column = std::make_shared<ColumnNullable>(tmp_res.column, null_map);
res.column = ColumnNullable::create(tmp_res.column, null_map);
};
}
else

View File

@ -554,7 +554,7 @@ struct DateTimeTransformImpl
const ColumnPtr source_col = block.getByPosition(arguments[0]).column;
if (const auto * sources = checkAndGetColumn<ColumnVector<FromType>>(source_col.get()))
{
auto col_to = std::make_shared<ColumnVector<ToType>>();
auto col_to = ColumnVector<ToType>::create();
block.getByPosition(result).column = col_to;
Op::vector(sources->getData(), col_to->getData(), time_zone);
}
@ -850,7 +850,7 @@ struct DateTimeAddIntervalImpl
if (const auto * sources = checkAndGetColumn<ColumnVector<FromType>>(source_col.get()))
{
auto col_to = std::make_shared<ColumnVector<ToType>>();
auto col_to = ColumnVector<ToType>::create();
block.getByPosition(result).column = col_to;
const IColumn & delta_column = *block.getByPosition(arguments[1]).column;
@ -862,7 +862,7 @@ struct DateTimeAddIntervalImpl
}
else if (const auto * sources = checkAndGetColumnConst<ColumnVector<FromType>>(source_col.get()))
{
auto col_to = std::make_shared<ColumnVector<ToType>>();
auto col_to = ColumnVector<ToType>::create();
block.getByPosition(result).column = col_to;
Op::constant_vector(sources->template getValue<FromType>(), col_to->getData(), *block.getByPosition(arguments[1]).column, time_zone);
}
@ -1109,7 +1109,7 @@ public:
{
if (const ColumnUInt32 * times = typeid_cast<const ColumnUInt32 *>(block.getByPosition(arguments[0]).column.get()))
{
auto res = std::make_shared<ColumnUInt32>();
auto res = ColumnUInt32::create();
ColumnPtr res_holder = res;
ColumnUInt32::Container_t & res_vec = res->getData();
const ColumnUInt32::Container_t & vec = times->getData();
@ -1243,7 +1243,7 @@ public:
auto durations = checkAndGetColumn<ColumnUInt32>(block.getByPosition(arguments[1]).column.get());
auto const_durations = checkAndGetColumnConst<ColumnUInt32>(block.getByPosition(arguments[1]).column.get());
auto res = std::make_shared<ColumnArray>(std::make_shared<ColumnUInt32>());
auto res = ColumnArray::create(ColumnUInt32::create());
ColumnPtr res_holder = res;
ColumnUInt32::Container_t & res_values = typeid_cast<ColumnUInt32 &>(res->getData()).getData();

View File

@ -240,7 +240,7 @@ public:
if (const ColumnVector<T> * col_from = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnVector<T>>();
auto col_to = ColumnVector<T>::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();
@ -338,7 +338,7 @@ public:
if (col_vec1 && col_vec2)
{
auto col_to = std::make_shared<ColumnUInt8>();
auto col_to = ColumnUInt8::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from1 = col_vec1->getData();
@ -352,7 +352,7 @@ public:
}
else if (col_vec1 && col_const2)
{
auto col_to = std::make_shared<ColumnUInt8>();
auto col_to = ColumnUInt8::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from1 = col_vec1->getData();
@ -366,7 +366,7 @@ public:
}
else if (col_const1 && col_vec2)
{
auto col_to = std::make_shared<ColumnUInt8>();
auto col_to = ColumnUInt8::create();
block.getByPosition(result).column = col_to;
const T const_from1 = col_const1->template getValue<T>();
@ -464,8 +464,8 @@ public:
if (const ColumnVector<T> * col_from = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_values = std::make_shared<ColumnVector<T>>();
auto col_array = std::make_shared<ColumnArray>(col_values);
auto col_values = ColumnVector<T>::create();
auto col_array = ColumnArray::create(col_values);
block.getByPosition(result).column = col_array;
ColumnArray::Offsets_t & res_offsets = col_array->getOffsets();
@ -734,7 +734,7 @@ public:
if (const ColumnUInt32 * col_from = typeid_cast<const ColumnUInt32 *>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const ColumnUInt32::Container_t & region_ids = col_from->getData();

View File

@ -129,7 +129,7 @@ private:
{
const auto & ids = id_col->getData();
const auto out = std::make_shared<ColumnUInt8>(ext::size(ids));
const auto out = ColumnUInt8::create(ext::size(ids));
block.getByPosition(result).column = out;
dict->has(ids, out->getData());
@ -169,7 +169,7 @@ private:
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col_materialized).getColumns();
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
const auto out = std::make_shared<ColumnUInt8>(key_col_with_type.column->size());
const auto out = ColumnUInt8::create(key_col_with_type.column->size());
block.getByPosition(result).column = out;
dict->has(key_columns, key_types, out->getData());
@ -322,7 +322,7 @@ private:
const auto id_col_untyped = block.getByPosition(arguments[2]).column.get();
if (const auto id_col = checkAndGetColumn<ColumnUInt64>(id_col_untyped))
{
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
dict->getString(attr_name, id_col->getData(), out.get());
}
@ -375,7 +375,7 @@ private:
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col_materialized).getColumns();
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
dict->getString(attr_name, key_columns, key_types, out.get());
@ -433,13 +433,13 @@ private:
{
if (const auto date_col = checkAndGetColumn<ColumnUInt16>(date_col_untyped))
{
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
dictionary->getString(attr_name, id_col->getData(), date_col->getData(), out.get());
}
else if (const auto date_col = checkAndGetColumnConst<ColumnVector<UInt16>>(date_col_untyped))
{
auto out = std::make_shared<ColumnString>();
auto out = ColumnString::create();
block.getByPosition(result).column = out;
const PaddedPODArray<UInt16> dates(id_col->size(), date_col->getValue<UInt64>());
@ -460,7 +460,7 @@ private:
{
if (const auto date_col = checkAndGetColumn<ColumnUInt16>(date_col_untyped))
{
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
const PaddedPODArray<UInt64> ids(date_col->size(), id_col->getValue<UInt64>());
@ -598,7 +598,7 @@ private:
if (const auto default_col = checkAndGetColumn<ColumnString>(default_col_untyped))
{
/// vector ids, vector defaults
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
const auto & ids = id_col->getData();
@ -608,7 +608,7 @@ private:
else if (const auto default_col = checkAndGetColumnConstStringOrFixedString(default_col_untyped))
{
/// vector ids, const defaults
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
const auto & ids = id_col->getData();
@ -634,7 +634,7 @@ private:
/// const ids, vector defaults
/// @todo avoid materialization
const PaddedPODArray<UInt64> ids(id_col->size(), id_col->getValue<UInt64>());
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
dictionary->getString(attr_name, ids, default_col, out.get());
@ -681,7 +681,7 @@ private:
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col_materialized).getColumns();
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
const auto out = std::make_shared<ColumnString>();
const auto out = ColumnString::create();
block.getByPosition(result).column = out;
const auto default_col_untyped = block.getByPosition(arguments[3]).column.get();
@ -877,7 +877,7 @@ private:
const auto id_col_untyped = block.getByPosition(arguments[2]).column.get();
if (const auto id_col = checkAndGetColumn<ColumnUInt64>(id_col_untyped))
{
const auto out = std::make_shared<ColumnVector<Type>>(id_col->size());
const auto out = ColumnVector<Type>::create(id_col->size());
block.getByPosition(result).column = out;
const auto & ids = id_col->getData();
@ -934,7 +934,7 @@ private:
const auto & key_columns = static_cast<const ColumnTuple &>(*key_col_materialized).getColumns();
const auto & key_types = static_cast<const DataTypeTuple &>(*key_col_with_type.type).getElements();
const auto out = std::make_shared<ColumnVector<Type>>(key_columns.front()->size());
const auto out = ColumnVector<Type>::create(key_columns.front()->size());
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -998,7 +998,7 @@ private:
const auto & ids = id_col->getData();
const auto & dates = date_col->getData();
const auto out = std::make_shared<ColumnVector<Type>>(size);
const auto out = ColumnVector<Type>::create(size);
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -1010,7 +1010,7 @@ private:
const auto & ids = id_col->getData();
const PaddedPODArray<UInt16> dates(size, date_col->getValue<UInt16>());
const auto out = std::make_shared<ColumnVector<Type>>(size);
const auto out = ColumnVector<Type>::create(size);
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -1035,7 +1035,7 @@ private:
const PaddedPODArray<UInt64> ids(size, id_col->getValue<UInt64>());
const auto & dates = date_col->getData();
const auto out = std::make_shared<ColumnVector<Type>>(size);
const auto out = ColumnVector<Type>::create(size);
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -1209,7 +1209,7 @@ private:
if (const auto default_col = checkAndGetColumn<ColumnVector<Type>>(default_col_untyped))
{
/// vector ids, vector defaults
const auto out = std::make_shared<ColumnVector<Type>>(id_col->size());
const auto out = ColumnVector<Type>::create(id_col->size());
block.getByPosition(result).column = out;
const auto & ids = id_col->getData();
@ -1221,7 +1221,7 @@ private:
else if (const auto default_col = checkAndGetColumnConst<ColumnVector<Type>>(default_col_untyped))
{
/// vector ids, const defaults
const auto out = std::make_shared<ColumnVector<Type>>(id_col->size());
const auto out = ColumnVector<Type>::create(id_col->size());
block.getByPosition(result).column = out;
const auto & ids = id_col->getData();
@ -1249,7 +1249,7 @@ private:
/// @todo avoid materialization
const PaddedPODArray<UInt64> ids(id_col->size(), id_col->getValue<UInt64>());
const auto out = std::make_shared<ColumnVector<Type>>(id_col->size());
const auto out = ColumnVector<Type>::create(id_col->size());
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -1300,7 +1300,7 @@ private:
/// @todo detect when all key columns are constant
const auto rows = key_col.size();
const auto out = std::make_shared<ColumnVector<Type>>(rows);
const auto out = ColumnVector<Type>::create(rows);
block.getByPosition(result).column = out;
auto & data = out->getData();
@ -1495,8 +1495,8 @@ private:
if (const auto id_col = checkAndGetColumn<ColumnUInt64>(id_col_untyped))
{
const auto & in = id_col->getData();
const auto backend = std::make_shared<ColumnUInt64>();
const auto array = std::make_shared<ColumnArray>(backend);
const auto backend = ColumnUInt64::create();
const auto array = ColumnArray::create(backend);
block.getByPosition(result).column = array;
get_hierarchies(in, backend->getData(), array->getOffsets());
@ -1504,8 +1504,8 @@ private:
else if (const auto id_col = checkAndGetColumnConst<ColumnVector<UInt64>>(id_col_untyped))
{
const PaddedPODArray<UInt64> in(1, id_col->getValue<UInt64>());
const auto backend = std::make_shared<ColumnUInt64>();
const auto array = std::make_shared<ColumnArray>(backend);
const auto backend = ColumnUInt64::create();
const auto array = ColumnArray::create(backend);
get_hierarchies(in, backend->getData(), array->getOffsets());
@ -1625,7 +1625,7 @@ private:
{
if (const auto ancestor_id_col = checkAndGetColumn<ColumnUInt64>(ancestor_id_col_untyped))
{
const auto out = std::make_shared<ColumnUInt8>();
const auto out = ColumnUInt8::create();
block.getByPosition(result).column = out;
const auto & child_ids = child_id_col->getData();
@ -1638,7 +1638,7 @@ private:
}
else if (const auto ancestor_id_col = checkAndGetColumnConst<ColumnVector<UInt64>>(ancestor_id_col_untyped))
{
const auto out = std::make_shared<ColumnUInt8>();
const auto out = ColumnUInt8::create();
block.getByPosition(result).column = out;
const auto & child_ids = child_id_col->getData();
@ -1666,7 +1666,7 @@ private:
{
if (const auto ancestor_id_col = checkAndGetColumn<ColumnUInt64>(ancestor_id_col_untyped))
{
const auto out = std::make_shared<ColumnUInt8>();
const auto out = ColumnUInt8::create();
block.getByPosition(result).column = out;
const auto child_id = child_id_col->getValue<UInt64>();

View File

@ -91,7 +91,7 @@ private:
{
if (const ColumnVector<T> * col_from = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();
@ -169,7 +169,7 @@ private:
{
if (const ColumnVector<T> * col_from = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();

View File

@ -169,7 +169,7 @@ public:
result_column = executeForType<Float32>(*tuple_columns[0], *tuple_columns[1], block, arguments);
if (const_tuple_col)
result_column = std::make_shared<ColumnConst>(result_column, const_tuple_col->size());
result_column = ColumnConst::create(result_column, const_tuple_col->size());
}
private:

View File

@ -135,7 +135,7 @@ private:
}
else
{
const auto dst = std::make_shared<ColumnVector<Float64>>();
const auto dst = ColumnVector<Float64>::create();
block.getByPosition(result).column = dst;
auto & dst_data = dst->getData();
dst_data.resize(size);
@ -273,7 +273,7 @@ private:
const auto col_vec_x = static_cast<const ColumnVector<Float64> *> (col_x);
const auto col_vec_y = static_cast<const ColumnVector<Float64> *> (col_y);
const auto dst = std::make_shared<ColumnVector<UInt8>>();
const auto dst = ColumnVector<UInt8>::create();
block.getByPosition(result).column = dst;
auto & dst_data = dst->getData();
dst_data.resize(size);

View File

@ -205,7 +205,7 @@ public:
{
if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnUInt64>();
auto col_to = ColumnUInt64::create();
block.getByPosition(result).column = col_to;
const typename ColumnString::Chars_t & data = col_from->getChars();
@ -256,7 +256,7 @@ public:
{
if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnFixedString>(Impl::length);
auto col_to = ColumnFixedString::create(Impl::length);
block.getByPosition(result).column = col_to;
const typename ColumnString::Chars_t & data = col_from->getChars();
@ -294,7 +294,7 @@ private:
{
if (auto col_from = checkAndGetColumn<ColumnVector<FromType>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnVector<ToType>>();
auto col_to = ColumnVector<ToType>::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<FromType>::Container_t & vec_from = col_from->getData();
@ -586,7 +586,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override
{
size_t rows = block.rows();
auto col_to = std::make_shared<ColumnUInt64>(rows);
auto col_to = ColumnUInt64::create(rows);
block.getByPosition(result).column = col_to;
ColumnUInt64::Container_t & vec_to = col_to->getData();
@ -758,7 +758,7 @@ private:
if (const auto col_from = checkAndGetColumn<ColumnString>(col_untyped))
{
const auto size = col_from->size();
const auto col_to = std::make_shared<ColumnUInt64>(size);
const auto col_to = ColumnUInt64::create(size);
block.getByPosition(result).column = col_to;
const auto & chars = col_from->getChars();
@ -791,7 +791,7 @@ private:
if (const auto col_from = checkAndGetColumn<ColumnString>(col_untyped))
{
const auto size = col_from->size();
const auto col_to = std::make_shared<ColumnUInt64>(size);
const auto col_to = ColumnUInt64::create(size);
block.getByPosition(result).column = col_to;
const auto & chars = col_from->getChars();

View File

@ -51,8 +51,8 @@ struct ArrayMapImpl
static ColumnPtr execute(const ColumnArray & array, ColumnPtr mapped)
{
return mapped->isColumnConst()
? std::make_shared<ColumnArray>(mapped->convertToFullColumnIfConst(), array.getOffsetsColumn())
: std::make_shared<ColumnArray>(mapped, array.getOffsetsColumn());
? ColumnArray::create(mapped->convertToFullColumnIfConst(), array.getOffsetsColumn())
: ColumnArray::create(mapped, array.getOffsetsColumn());
}
};
@ -82,7 +82,7 @@ struct ArrayFilterImpl
if (column_filter_const->getValue<UInt8>())
return array.clone();
else
return std::make_shared<ColumnArray>(
return ColumnArray::create(
array.getDataPtr()->cloneEmpty(),
std::make_shared<ColumnArray::ColumnOffsets_t>(array.size(), 0));
}
@ -107,7 +107,7 @@ struct ArrayFilterImpl
out_offsets[i] = out_pos;
}
return std::make_shared<ColumnArray>(filtered, column_offsets_ptr);
return ColumnArray::create(filtered, column_offsets_ptr);
}
};
@ -136,7 +136,7 @@ struct ArrayCountImpl
if (column_filter_const->getValue<UInt8>())
{
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt32>(offsets.size());
auto out_column = ColumnUInt32::create(offsets.size());
ColumnUInt32::Container_t & out_counts = out_column->getData();
size_t pos = 0;
@ -154,7 +154,7 @@ struct ArrayCountImpl
const IColumn::Filter & filter = column_filter->getData();
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt32>(offsets.size());
auto out_column = ColumnUInt32::create(offsets.size());
ColumnUInt32::Container_t & out_counts = out_column->getData();
size_t pos = 0;
@ -198,7 +198,7 @@ struct ArrayExistsImpl
if (column_filter_const->getValue<UInt8>())
{
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt8>(offsets.size());
auto out_column = ColumnUInt8::create(offsets.size());
ColumnUInt8::Container_t & out_exists = out_column->getData();
size_t pos = 0;
@ -216,7 +216,7 @@ struct ArrayExistsImpl
const IColumn::Filter & filter = column_filter->getData();
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt8>(offsets.size());
auto out_column = ColumnUInt8::create(offsets.size());
ColumnUInt8::Container_t & out_exists = out_column->getData();
size_t pos = 0;
@ -266,7 +266,7 @@ struct ArrayAllImpl
else
{
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt8>(offsets.size());
auto out_column = ColumnUInt8::create(offsets.size());
ColumnUInt8::Container_t & out_all = out_column->getData();
size_t pos = 0;
@ -282,7 +282,7 @@ struct ArrayAllImpl
const IColumn::Filter & filter = column_filter->getData();
const IColumn::Offsets_t & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt8>(offsets.size());
auto out_column = ColumnUInt8::create(offsets.size());
ColumnUInt8::Container_t & out_all = out_column->getData();
size_t pos = 0;
@ -346,7 +346,7 @@ struct ArraySumImpl
const Element x = column_const->template getValue<Element>();
auto res_column = std::make_shared<ColumnVector<Result>>(offsets.size());
auto res_column = ColumnVector<Result>::create(offsets.size());
res_ptr = res_column;
typename ColumnVector<Result>::Container_t & res = res_column->getData();
@ -361,7 +361,7 @@ struct ArraySumImpl
}
const typename ColumnVector<Element>::Container_t & data = column->getData();
auto res_column = std::make_shared<ColumnVector<Result>>(offsets.size());
auto res_column = ColumnVector<Result>::create(offsets.size());
res_ptr = res_column;
typename ColumnVector<Result>::Container_t & res = res_column->getData();
@ -502,7 +502,7 @@ struct ArrayFirstIndexImpl
if (column_filter_const->getValue<UInt8>())
{
const auto & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt32>(offsets.size());
auto out_column = ColumnUInt32::create(offsets.size());
auto & out_index = out_column->getData();
size_t pos{};
@ -520,7 +520,7 @@ struct ArrayFirstIndexImpl
const auto & filter = column_filter->getData();
const auto & offsets = array.getOffsets();
auto out_column = std::make_shared<ColumnUInt32>(offsets.size());
auto out_column = ColumnUInt32::create(offsets.size());
auto & out_index = out_column->getData();
size_t pos{};
@ -593,7 +593,7 @@ struct ArraySortImpl
current_offset = next_offset;
}
return std::make_shared<ColumnArray>(array.getData().permute(permutation, 0), array.getOffsetsColumn());
return ColumnArray::create(array.getData().permute(permutation, 0), array.getOffsetsColumn());
}
};

View File

@ -308,7 +308,7 @@ public:
if (has_consts && Impl<UInt8>::apply(const_val, 0) == 0 && Impl<UInt8>::apply(const_val, 1) == 1)
has_consts = false;
auto col_res = std::make_shared<ColumnUInt8>();
auto col_res = ColumnUInt8::create();
block.getByPosition(result).column = col_res;
UInt8Container & vec_res = col_res->getData();
@ -384,7 +384,7 @@ private:
{
if (auto col = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_res = std::make_shared<ColumnUInt8>();
auto col_res = ColumnUInt8::create();
block.getByPosition(result).column = col_res;
typename ColumnUInt8::Container_t & vec_res = col_res->getData();

View File

@ -91,7 +91,7 @@ private:
{
if (const auto col = checkAndGetColumn<ColumnVector<FieldType>>(arg))
{
const auto dst = std::make_shared<ColumnVector<Float64>>();
const auto dst = ColumnVector<Float64>::create();
block.getByPosition(result).column = dst;
const auto & src_data = col->getData();
@ -221,7 +221,7 @@ private:
{
if (const auto right_arg_typed = checkAndGetColumn<ColumnVector<RightType>>(right_arg))
{
const auto dst = std::make_shared<ColumnVector<Float64>>();
const auto dst = ColumnVector<Float64>::create();
block.getByPosition(result).column = dst;
LeftType left_src_data[Impl::rows_per_iteration];
@ -261,7 +261,7 @@ private:
{
if (const auto right_arg_typed = checkAndGetColumn<ColumnVector<RightType>>(right_arg))
{
const auto dst = std::make_shared<ColumnVector<Float64>>();
const auto dst = ColumnVector<Float64>::create();
block.getByPosition(result).column = dst;
const auto & left_src_data = left_arg->getData();
@ -295,7 +295,7 @@ private:
}
else if (const auto right_arg_typed = checkAndGetColumnConst<ColumnVector<RightType>>(right_arg))
{
const auto dst = std::make_shared<ColumnVector<Float64>>();
const auto dst = ColumnVector<Float64>::create();
block.getByPosition(result).column = dst;
const auto & left_src_data = left_arg->getData();

View File

@ -411,7 +411,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & /*arguments*/, size_t result) override
{
size_t size = block.rows();
block.getByPosition(result).column = std::make_shared<ColumnUInt64>(size, size);
block.getByPosition(result).column = ColumnUInt64::create(size, size);
}
};
@ -449,7 +449,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & /*arguments*/, size_t result) override
{
size_t size = block.rows();
auto column = std::make_shared<ColumnUInt64>();
auto column = ColumnUInt64::create();
auto & data = column->getData();
data.resize(size);
for (size_t i = 0; i < size; ++i)
@ -497,7 +497,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & /*arguments*/, size_t result) override
{
size_t current_block_number = block_number++;
block.getByPosition(result).column = std::make_shared<ColumnUInt64>(block.rows(), current_block_number);
block.getByPosition(result).column = ColumnUInt64::create(block.rows(), current_block_number);
}
};
@ -541,7 +541,7 @@ public:
size_t rows_in_block = block.rows();
size_t current_row_number = rows.fetch_add(rows_in_block);
auto column = std::make_shared<ColumnUInt64>();
auto column = ColumnUInt64::create();
auto & data = column->getData();
data.resize(rows_in_block);
for (size_t i = 0; i < rows_in_block; ++i)
@ -807,7 +807,7 @@ public:
if (auto converted = tuple_columns[i]->convertToFullColumnIfConst())
tuple_columns[i] = converted;
}
block.getByPosition(result).column = std::make_shared<ColumnTuple>(tuple_columns);
block.getByPosition(result).column = ColumnTuple::create(tuple_columns);
}
};
@ -1088,7 +1088,7 @@ void FunctionReplicate::executeImpl(Block & block, const ColumnNumbers & argumen
}
block.getByPosition(result).column
= std::make_shared<ColumnArray>(first_column->replicate(array_column->getOffsets()), array_column->getOffsetsColumn());
= ColumnArray::create(first_column->replicate(array_column->getOffsets()), array_column->getOffsetsColumn());
}
/** Returns a string with nice Unicode-art bar with resolution of 1/8 part of symbol.
@ -1151,7 +1151,7 @@ public:
const auto & src = *block.getByPosition(arguments[0]).column;
auto res_column = std::make_shared<ColumnString>();
auto res_column = ColumnString::create();
block.getByPosition(result).column = res_column;
if (executeNumber<UInt8>(src, *res_column, min, max, max_width) || executeNumber<UInt16>(src, *res_column, min, max, max_width)
@ -1283,7 +1283,7 @@ public:
{
const auto size = in->size();
const auto out = std::make_shared<ColumnUInt8>(size);
const auto out = ColumnUInt8::create(size);
block.getByPosition(result).column = out;
const auto & in_data = in->getData();
@ -1780,7 +1780,7 @@ void FunctionVisibleWidth::executeImpl(Block & block, const ColumnNumbers & argu
auto & src = block.getByPosition(arguments[0]);
size_t size = block.rows();
auto res_col = std::make_shared<ColumnUInt64>(size);
auto res_col = ColumnUInt64::create(size);
auto & res_data = static_cast<ColumnUInt64 &>(*res_col).getData();
block.getByPosition(result).column = res_col;

View File

@ -152,7 +152,7 @@ public:
void executeImpl(Block & block, const ColumnNumbers & /*arguments*/, size_t result) override
{
auto col_to = std::make_shared<ColumnVector<ToType>>();
auto col_to = ColumnVector<ToType>::create();
block.getByPosition(result).column = col_to;
typename ColumnVector<ToType>::Container_t & vec_to = col_to->getData();

View File

@ -55,7 +55,7 @@ public:
{
if (auto col_from = checkAndGetColumn<ColumnVector<T>>(block.getByPosition(arguments[0]).column.get()))
{
auto col_to = std::make_shared<ColumnString>();
auto col_to = ColumnString::create();
block.getByPosition(result).column = col_to;
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();
@ -141,7 +141,7 @@ public:
{
if (ColumnString * col_from = typeid_cast<ColumnString *>(block.getByPosition(arguments[0]).column.get()))
{
auto col_res = std::make_shared<ColumnVector<ToFieldType>>();
auto col_res = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & data_from = col_from->getChars();
@ -161,7 +161,7 @@ public:
}
else if (ColumnFixedString * col_from = typeid_cast<ColumnFixedString *>(block.getByPosition(arguments[0]).column.get()))
{
auto col_res = std::make_shared<ColumnVector<ToFieldType>>();
auto col_res = ColumnVector<ToFieldType>::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & data_from = col_from->getChars();

View File

@ -490,7 +490,7 @@ struct Dispatcher
scale_arg = scale_field.get<Int64>();
}
auto col_res = std::make_shared<ColumnVector<T>>();
auto col_res = ColumnVector<T>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<T>::Container_t & vec_res = col_res->getData();

View File

@ -541,7 +541,7 @@ public:
const ColumnPtr column = block.getByPosition(arguments[0]).column;
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -560,7 +560,7 @@ public:
}
else
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -570,7 +570,7 @@ public:
}
else if (const ColumnArray * col = checkAndGetColumn<ColumnArray>(column.get()))
{
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -627,13 +627,13 @@ public:
const ColumnPtr column = block.getByPosition(arguments[0]).column;
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ReverseImpl::vector(col->getChars(), col->getOffsets(), col_res->getChars(), col_res->getOffsets());
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column.get()))
{
auto col_res = std::make_shared<ColumnFixedString>(col->getN());
auto col_res = ColumnFixedString::create(col->getN());
block.getByPosition(result).column = col_res;
ReverseImpl::vector_fixed(col->getChars(), col->getN(), col_res->getChars());
}
@ -728,7 +728,7 @@ private:
const ColumnConst * c0_const_string = checkAndGetColumnConst<ColumnString>(c0);
const ColumnConst * c1_const_string = checkAndGetColumnConst<ColumnString>(c1);
auto c_res = std::make_shared<ColumnString>();
auto c_res = ColumnString::create();
if (c0_string && c1_string)
concat(StringSource(*c0_string), StringSource(*c1_string), StringSink(*c_res, c0->size()));
@ -754,7 +754,7 @@ private:
for (size_t i = 0; i < num_sources; ++i)
sources[i] = createDynamicStringSource(*block.getByPosition(arguments[i]).column);
auto c_res = std::make_shared<ColumnString>();
auto c_res = ColumnString::create();
concat(sources, StringSink(*c_res, block.rows()));
block.getByPosition(result).column = c_res;
}
@ -815,7 +815,7 @@ public:
Block & block, size_t result,
Source && source)
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
if (!column_length)
{
@ -964,7 +964,7 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column_string.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
SubstringUTF8Impl::vector(col->getChars(), col->getOffsets(), start, length, col_res->getChars(), col_res->getOffsets());
}
@ -1028,7 +1028,7 @@ private:
if (const auto col = checkAndGetColumn<ColumnString>(column.get()))
{
auto col_res = std::make_shared<ColumnString>();
auto col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
const auto & src_data = col->getChars();

View File

@ -170,13 +170,13 @@ public:
const ColumnPtr column = block.getByPosition(arguments[0]).column;
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
Impl::vector(col->getChars(), col->getOffsets(), col_res->getChars(), col_res->getOffsets());
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column.get()))
{
auto col_res = std::make_shared<ColumnFixedString>(col->getN());
auto col_res = ColumnFixedString::create(col->getN());
block.getByPosition(result).column = col_res;
Impl::vector_fixed(col->getChars(), col->getN(), col_res->getChars());
}

View File

@ -349,7 +349,7 @@ public:
const ColumnConst * col_const_str =
checkAndGetColumnConstStringOrFixedString(block.getByPosition(array_argument_position).column.get());
auto col_res = std::make_shared<ColumnArray>(std::make_shared<ColumnString>());
auto col_res = ColumnArray::create(ColumnString::create());
ColumnPtr col_res_holder = col_res;
ColumnString & res_strings = typeid_cast<ColumnString &>(col_res->getData());
ColumnArray::Offsets_t & res_offsets = col_res->getOffsets();
@ -545,7 +545,7 @@ public:
const ColumnArray & col_arr = static_cast<const ColumnArray &>(*block.getByPosition(arguments[0]).column);
const ColumnString & col_string = static_cast<const ColumnString &>(col_arr.getData());
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
executeInternal(

View File

@ -994,13 +994,13 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column_src.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
Impl::vector(col->getChars(), col->getOffsets(), needle, replacement, col_res->getChars(), col_res->getOffsets());
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column_src.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
Impl::vector_fixed(col->getChars(), col->getN(), needle, replacement, col_res->getChars(), col_res->getOffsets());
}

View File

@ -90,7 +90,7 @@ public:
return;
}
auto col_res = std::make_shared<ColumnVector<ResultType>>();
auto col_res = ColumnVector<ResultType>::create();
block.getByPosition(result).column = col_res;
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
@ -166,7 +166,7 @@ public:
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column.get()))
{
std::shared_ptr<ColumnString> col_res = std::make_shared<ColumnString>();
std::shared_ptr<ColumnString> col_res = ColumnString::create();
block.getByPosition(result).column = col_res;
ColumnString::Chars_t & vec_res = col_res->getChars();

View File

@ -514,10 +514,10 @@ ColumnPtr pointInPolygon(const ColumnVector<T> & x, const ColumnVector<U> & y, P
if (impl.hasEmptyBound())
{
return std::make_shared<ColumnVector<UInt8>>(size, 0);
return ColumnVector<UInt8>::create(size, 0);
}
auto result = std::make_shared<ColumnVector<UInt8>>(size);
auto result = ColumnVector<UInt8>::create(size);
auto & data = result->getData();
const auto & x_data = x.getData();

View File

@ -76,9 +76,9 @@ ColumnPtr wrapInNullable(const ColumnPtr & src, Block & block, const ColumnNumbe
return makeNullable(src);
if (src->isColumnConst())
return std::make_shared<ColumnNullable>(src->convertToFullColumnIfConst(), result_null_map_column);
return ColumnNullable::create(src->convertToFullColumnIfConst(), result_null_map_column);
else
return std::make_shared<ColumnNullable>(src, result_null_map_column);
return ColumnNullable::create(src, result_null_map_column);
}
@ -194,7 +194,7 @@ bool defaultImplementationForConstantArguments(
func.execute(temporary_block, temporary_argument_numbers, arguments_size);
block.getByPosition(result).column = std::make_shared<ColumnConst>(temporary_block.getByPosition(arguments_size).column, block.rows());
block.getByPosition(result).column = ColumnConst::create(temporary_block.getByPosition(arguments_size).column, block.rows());
return true;
}

View File

@ -2066,7 +2066,7 @@ void ExpressionAnalyzer::getActionsImpl(const ASTPtr & ast, bool no_subqueries,
if (node->name == "indexHint")
{
actions_stack.addAction(ExpressionAction::addColumn(ColumnWithTypeAndName(
std::make_shared<ColumnConst>(std::make_shared<ColumnUInt8>(1, 1), 1), std::make_shared<DataTypeUInt8>(), node->getColumnName())));
ColumnConst::create(ColumnUInt8::create(1, 1), 1), std::make_shared<DataTypeUInt8>(), node->getColumnName())));
return;
}
@ -2114,7 +2114,7 @@ void ExpressionAnalyzer::getActionsImpl(const ASTPtr & ast, bool no_subqueries,
if (!actions_stack.getSampleBlock().has(column.name))
{
column.column = std::make_shared<ColumnSet>(1, set);
column.column = ColumnSet::create(1, set);
actions_stack.addAction(ExpressionAction::addColumn(column));
}
@ -2198,7 +2198,7 @@ void ExpressionAnalyzer::getActionsImpl(const ASTPtr & ast, bool no_subqueries,
argument_names[i] = getUniqueName(actions_stack.getSampleBlock(), "__lambda");
ColumnWithTypeAndName lambda_column;
lambda_column.column = std::make_shared<ColumnExpression>(1, lambda_actions, lambda_arguments, result_type, result_name);
lambda_column.column = ColumnExpression::create(1, lambda_actions, lambda_arguments, result_type, result_name);
lambda_column.type = argument_types[i];
lambda_column.name = argument_names[i];
actions_stack.addAction(ExpressionAction::addColumn(lambda_column));

View File

@ -210,13 +210,13 @@ BlockIO InterpreterCheckQuery::execute()
/// Construct the result.
ColumnPtr status_column = std::make_shared<ColumnUInt8>();
ColumnPtr host_name_column = std::make_shared<ColumnString>();
ColumnPtr host_address_column = std::make_shared<ColumnString>();
ColumnPtr port_column = std::make_shared<ColumnUInt16>();
ColumnPtr user_column = std::make_shared<ColumnString>();
ColumnPtr structure_class_column = std::make_shared<ColumnUInt32>();
ColumnPtr structure_column = std::make_shared<ColumnString>();
ColumnPtr status_column = ColumnUInt8::create();
ColumnPtr host_name_column = ColumnString::create();
ColumnPtr host_address_column = ColumnString::create();
ColumnPtr port_column = ColumnUInt16::create();
ColumnPtr user_column = ColumnString::create();
ColumnPtr structure_class_column = ColumnUInt32::create();
ColumnPtr structure_column = ColumnString::create();
/// This value is 1 if the structure is not disposed of anywhere, but 0 otherwise.
UInt8 status_value = (structure_class == 0) ? 1 : 0;
@ -250,7 +250,7 @@ BlockIO InterpreterCheckQuery::execute()
}
else
{
result = Block{{ std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "result" }};
result = Block{{ ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "result" }};
result.safeGetByPosition(0).column->insert(Field(UInt64(table->checkData())));
BlockIO res;

View File

@ -66,10 +66,10 @@ BlockInputStreamPtr InterpreterDescribeQuery::executeImpl()
column_defaults = table->column_defaults;
}
ColumnWithTypeAndName name_column{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName type_column{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "type" };
ColumnWithTypeAndName default_type_column{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "default_type" };
ColumnWithTypeAndName default_expression_column{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "default_expression" };;
ColumnWithTypeAndName name_column{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName type_column{ColumnString::create(), std::make_shared<DataTypeString>(), "type" };
ColumnWithTypeAndName default_type_column{ColumnString::create(), std::make_shared<DataTypeString>(), "default_type" };
ColumnWithTypeAndName default_expression_column{ColumnString::create(), std::make_shared<DataTypeString>(), "default_expression" };;
for (const auto column : columns)
{

View File

@ -35,7 +35,7 @@ BlockInputStreamPtr InterpreterExistsQuery::executeImpl()
bool res = context.isTableExist(ast.database, ast.table);
return std::make_shared<OneBlockInputStream>(Block{{
std::make_shared<ColumnUInt8>(1, res),
ColumnUInt8::create(1, res),
std::make_shared<DataTypeUInt8>(),
"result" }});
}

View File

@ -189,7 +189,7 @@ BlockIO InterpreterKillQueryQuery::execute()
QueryDescriptors queries_to_stop = extractQueriesExceptMeAndCheckAccess(processes_block, context);
res_io.in_sample = processes_block.cloneEmpty();
res_io.in_sample.insert(0, {std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "kill_status"});
res_io.in_sample.insert(0, {ColumnString::create(), std::make_shared<DataTypeString>(), "kill_status"});
if (!query.sync || query.test)
{

View File

@ -39,7 +39,7 @@ BlockInputStreamPtr InterpreterShowCreateQuery::executeImpl()
formatAST(*context.getCreateQuery(ast.database, ast.table), stream, false, true);
String res = stream.str();
ColumnPtr column = std::make_shared<ColumnString>();
ColumnPtr column = ColumnString::create();
column->insert(res);
return std::make_shared<OneBlockInputStream>(Block{{

View File

@ -18,18 +18,18 @@ Block PartLogElement::createBlock()
{
return
{
{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "event_type"},
{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "event_type"},
{std::make_shared<ColumnUInt16>(), std::make_shared<DataTypeDate>(), "event_date"},
{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "event_time"},
{ColumnUInt16::create(), std::make_shared<DataTypeDate>(), "event_date"},
{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "event_time"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "size_in_bytes"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "duration_ms"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "size_in_bytes"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "duration_ms"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "database"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "table"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "part_name"},
{std::make_shared<ColumnArray>(std::make_shared<ColumnString>()),
{ColumnString::create(), std::make_shared<DataTypeString>(), "database"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "table"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "part_name"},
{ColumnArray::create(ColumnString::create()),
std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()), "merged_from"},
};
}

View File

@ -20,52 +20,52 @@ Block QueryLogElement::createBlock()
{
return
{
{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "type"},
{std::make_shared<ColumnUInt16>(), std::make_shared<DataTypeDate>(), "event_date"},
{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "event_time"},
{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "query_start_time"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "query_duration_ms"},
{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "type"},
{ColumnUInt16::create(), std::make_shared<DataTypeDate>(), "event_date"},
{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "event_time"},
{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "query_start_time"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "query_duration_ms"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "read_rows"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "read_bytes"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "read_rows"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "read_bytes"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "written_rows"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "written_bytes"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "written_rows"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "written_bytes"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "result_rows"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "result_bytes"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "result_rows"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "result_bytes"},
{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "memory_usage"},
{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "memory_usage"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "query"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "exception"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "stack_trace"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "query"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "exception"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "stack_trace"},
{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_initial_query"},
{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_initial_query"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "user"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "query_id"},
{std::make_shared<ColumnFixedString>(16), std::make_shared<DataTypeFixedString>(16), "address"},
{std::make_shared<ColumnUInt16>(), std::make_shared<DataTypeUInt16>(), "port"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "user"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "query_id"},
{ColumnFixedString::create(16), std::make_shared<DataTypeFixedString>(16), "address"},
{ColumnUInt16::create(), std::make_shared<DataTypeUInt16>(), "port"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "initial_user"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "initial_query_id"},
{std::make_shared<ColumnFixedString>(16), std::make_shared<DataTypeFixedString>(16), "initial_address"},
{std::make_shared<ColumnUInt16>(), std::make_shared<DataTypeUInt16>(), "initial_port"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "initial_user"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "initial_query_id"},
{ColumnFixedString::create(16), std::make_shared<DataTypeFixedString>(16), "initial_address"},
{ColumnUInt16::create(), std::make_shared<DataTypeUInt16>(), "initial_port"},
{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "interface"},
{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "interface"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "os_user"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "client_hostname"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "client_name"},
{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "client_revision"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "os_user"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "client_hostname"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "client_name"},
{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "client_revision"},
{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "http_method"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "http_user_agent"},
{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "http_method"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "http_user_agent"},
{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "quota_key"},
{ColumnString::create(), std::make_shared<DataTypeString>(), "quota_key"},
{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "revision"},
{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "revision"},
};
}

View File

@ -299,7 +299,7 @@ ColumnPtr Set::execute(const Block & block, bool negative) const
if (0 == num_key_columns)
throw Exception("Logical error: no columns passed to Set::execute method.", ErrorCodes::LOGICAL_ERROR);
auto res = std::make_shared<ColumnUInt8>();
auto res = ColumnUInt8::create();
ColumnUInt8::Container_t & vec_res = res->getData();
vec_res.resize(block.safeGetByPosition(0).column->size());

View File

@ -28,7 +28,7 @@ std::pair<Field, std::shared_ptr<IDataType>> evaluateConstantExpression(const AS
node, context, nullptr, NamesAndTypesList{{ "_dummy", std::make_shared<DataTypeUInt8>() }}).getConstActions();
/// There must be at least one column in the block so that it knows the number of rows.
Block block_with_constants{{ std::make_shared<ColumnConst>(std::make_shared<ColumnUInt8>(1, 0), 1), std::make_shared<DataTypeUInt8>(), "_dummy" }};
Block block_with_constants{{ ColumnConst::create(ColumnUInt8::create(1, 0), 1), std::make_shared<DataTypeUInt8>(), "_dummy" }};
expr_for_constant_folding->execute(block_with_constants);

View File

@ -27,7 +27,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = std::make_shared<DataTypeInt16>();
auto x = std::make_shared<ColumnInt16>();
auto x = ColumnInt16::create();
column_x.column = x;
auto & vec_x = x->getData();
@ -42,7 +42,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = std::make_shared<DataTypeString>();
column_s1.column = std::make_shared<ColumnString>();
column_s1.column = ColumnString::create();
for (size_t i = 0; i < n; ++i)
column_s1.column->insert(std::string(strings[i % 5]));
@ -52,7 +52,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = std::make_shared<DataTypeString>();
column_s2.column = std::make_shared<ColumnString>();
column_s2.column = ColumnString::create();
for (size_t i = 0; i < n; ++i)
column_s2.column->insert(std::string(strings[i % 3]));

View File

@ -68,7 +68,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = std::make_shared<DataTypeInt16>();
auto x = std::make_shared<ColumnInt16>();
auto x = ColumnInt16::create();
column_x.column = x;
auto & vec_x = x->getData();
@ -83,7 +83,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = std::make_shared<DataTypeString>();
column_s1.column = std::make_shared<ColumnString>();
column_s1.column = ColumnString::create();
for (size_t i = 0; i < n; ++i)
column_s1.column->insert(String(strings[i % 5]));
@ -93,7 +93,7 @@ int main(int argc, char ** argv)
ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = std::make_shared<DataTypeString>();
column_s2.column = std::make_shared<ColumnString>();
column_s2.column = ColumnString::create();
for (size_t i = 0; i < n; ++i)
column_s2.column->insert(String(strings[i % 3]));

View File

@ -74,7 +74,7 @@ MergeTreeDataSelectExecutor::MergeTreeDataSelectExecutor(MergeTreeData & data_)
static Block getBlockWithPartColumn(const MergeTreeData::DataPartsVector & parts)
{
Block res;
ColumnWithTypeAndName _part(std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "_part");
ColumnWithTypeAndName _part(ColumnString::create(), std::make_shared<DataTypeString>(), "_part");
for (const auto & part : parts)
_part.column->insert(part->name);

View File

@ -106,7 +106,7 @@ size_t MergeTreeReader::readRows(size_t from_mark, bool continue_reading, size_t
read_offsets = false; /// offsets have already been read on the previous iteration
if (!append)
column.column = std::make_shared<ColumnArray>(type_arr->getNestedType()->createColumn(), offset_columns[name]);
column.column = ColumnArray::create(type_arr->getNestedType()->createColumn(), offset_columns[name]);
}
else if (!append)
column.column = column.type->createColumn();
@ -480,7 +480,7 @@ void MergeTreeReader::fillMissingColumns(Block & res, const Names & ordered_name
ColumnPtr nested_column = nested_type->createColumnConst(
nested_rows, nested_type->getDefault())->convertToFullColumnIfConst();
column_to_add.column = std::make_shared<ColumnArray>(nested_column, offsets_column);
column_to_add.column = ColumnArray::create(nested_column, offsets_column);
}
else
{

View File

@ -226,7 +226,7 @@ Block LogBlockInputStream::readImpl()
else
read_offsets = false; /// on previous iterations the offsets were already read by `readData`
column.column = std::make_shared<ColumnArray>(type_arr->getNestedType()->createColumn(), offset_columns[name]);
column.column = ColumnArray::create(type_arr->getNestedType()->createColumn(), offset_columns[name]);
}
else
column.column = column.type->createColumn();

View File

@ -303,7 +303,7 @@ BlockInputStreams StorageMerge::read(
Block StorageMerge::getBlockWithVirtualColumns(const StorageListWithLocks & selected_tables) const
{
Block res;
ColumnWithTypeAndName _table(std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "_table");
ColumnWithTypeAndName _table(ColumnString::create(), std::make_shared<DataTypeString>(), "_table");
for (const auto & elem : selected_tables)
_table.column->insert(elem.first->getTableName());

View File

@ -211,7 +211,7 @@ Block TinyLogBlockInputStream::readImpl()
else
read_offsets = false; /// on previous iterations, the offsets were already calculated by `readData`
column.column = std::make_shared<ColumnArray>(type_arr->getNestedType()->createColumn(), offset_columns[nested_name]);
column.column = ColumnArray::create(type_arr->getNestedType()->createColumn(), offset_columns[nested_name]);
}
else
column.column = column.type->createColumn();

View File

@ -40,13 +40,13 @@ BlockInputStreams StorageSystemAsynchronousMetrics::read(
ColumnWithTypeAndName col_metric;
col_metric.name = "metric";
col_metric.type = std::make_shared<DataTypeString>();
col_metric.column = std::make_shared<ColumnString>();
col_metric.column = ColumnString::create();
block.insert(col_metric);
ColumnWithTypeAndName col_value;
col_value.name = "value";
col_value.type = std::make_shared<DataTypeFloat64>();
col_value.column = std::make_shared<ColumnFloat64>();
col_value.column = ColumnFloat64::create();
block.insert(col_value);
auto async_metrics_values = async_metrics.getValues();

View File

@ -32,8 +32,8 @@ BlockInputStreams StorageSystemBuildOptions::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_value{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "value"};
ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_value{ColumnString::create(), std::make_shared<DataTypeString>(), "value"};
for (auto it = auto_config_build; *it; it += 2)
{

View File

@ -40,16 +40,16 @@ BlockInputStreams StorageSystemClusters::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnPtr cluster_column = std::make_shared<ColumnString>();
ColumnPtr shard_num_column = std::make_shared<ColumnUInt32>();
ColumnPtr shard_weight_column = std::make_shared<ColumnUInt32>();
ColumnPtr replica_num_column = std::make_shared<ColumnUInt32>();
ColumnPtr host_name_column = std::make_shared<ColumnString>();
ColumnPtr host_address_column = std::make_shared<ColumnString>();
ColumnPtr port_column = std::make_shared<ColumnUInt16>();
ColumnPtr is_local_column = std::make_shared<ColumnUInt8>();
ColumnPtr user_column = std::make_shared<ColumnString>();
ColumnPtr default_database_column = std::make_shared<ColumnString>();
ColumnPtr cluster_column = ColumnString::create();
ColumnPtr shard_num_column = ColumnUInt32::create();
ColumnPtr shard_weight_column = ColumnUInt32::create();
ColumnPtr replica_num_column = ColumnUInt32::create();
ColumnPtr host_name_column = ColumnString::create();
ColumnPtr host_address_column = ColumnString::create();
ColumnPtr port_column = ColumnUInt16::create();
ColumnPtr is_local_column = ColumnUInt8::create();
ColumnPtr user_column = ColumnString::create();
ColumnPtr default_database_column = ColumnString::create();
auto updateColumns = [&](const std::string & cluster_name, const Cluster::ShardInfo & shard_info,
const Cluster::Address & address)

View File

@ -51,7 +51,7 @@ BlockInputStreams StorageSystemColumns::read(
Databases databases = context.getDatabases();
/// Add `database` column.
ColumnPtr database_column = std::make_shared<ColumnString>();
ColumnPtr database_column = ColumnString::create();
for (const auto & database : databases)
database_column->insert(database.first);
block.insert(ColumnWithTypeAndName(database_column, std::make_shared<DataTypeString>(), "database"));
@ -66,7 +66,7 @@ BlockInputStreams StorageSystemColumns::read(
size_t rows = database_column->size();
/// Add `table` column.
ColumnPtr table_column = std::make_shared<ColumnString>();
ColumnPtr table_column = ColumnString::create();
IColumn::Offsets_t offsets(rows);
for (size_t i = 0; i < rows; ++i)
{
@ -104,15 +104,15 @@ BlockInputStreams StorageSystemColumns::read(
ColumnPtr filtered_table_column = block.getByName("table").column;
/// We compose the result.
ColumnPtr database_column = std::make_shared<ColumnString>();
ColumnPtr table_column = std::make_shared<ColumnString>();
ColumnPtr name_column = std::make_shared<ColumnString>();
ColumnPtr type_column = std::make_shared<ColumnString>();
ColumnPtr default_kind_column = std::make_shared<ColumnString>();
ColumnPtr default_expression_column = std::make_shared<ColumnString>();
ColumnPtr data_compressed_bytes_column = std::make_shared<ColumnUInt64>();
ColumnPtr data_uncompressed_bytes_column = std::make_shared<ColumnUInt64>();
ColumnPtr marks_bytes_column = std::make_shared<ColumnUInt64>();
ColumnPtr database_column = ColumnString::create();
ColumnPtr table_column = ColumnString::create();
ColumnPtr name_column = ColumnString::create();
ColumnPtr type_column = ColumnString::create();
ColumnPtr default_kind_column = ColumnString::create();
ColumnPtr default_expression_column = ColumnString::create();
ColumnPtr data_compressed_bytes_column = ColumnUInt64::create();
ColumnPtr data_uncompressed_bytes_column = ColumnUInt64::create();
ColumnPtr marks_bytes_column = ColumnUInt64::create();
size_t rows = filtered_database_column->size();
for (size_t i = 0; i < rows; ++i)

View File

@ -34,10 +34,10 @@ BlockInputStreams StorageSystemDatabases::read(
Block block;
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
block.insert(col_name);
ColumnWithTypeAndName col_engine{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "engine"};
ColumnWithTypeAndName col_engine{ColumnString::create(), std::make_shared<DataTypeString>(), "engine"};
block.insert(col_engine);
auto databases = context.getDatabases();

View File

@ -51,29 +51,29 @@ BlockInputStreams StorageSystemDictionaries::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_origin{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "origin"};
ColumnWithTypeAndName col_type{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "type"};
ColumnWithTypeAndName col_key{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "key"};
ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_origin{ColumnString::create(), std::make_shared<DataTypeString>(), "origin"};
ColumnWithTypeAndName col_type{ColumnString::create(), std::make_shared<DataTypeString>(), "type"};
ColumnWithTypeAndName col_key{ColumnString::create(), std::make_shared<DataTypeString>(), "key"};
ColumnWithTypeAndName col_attribute_names{
std::make_shared<ColumnArray>(std::make_shared<ColumnString>()),
ColumnArray::create(ColumnString::create()),
std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()),
"attribute.names"
};
ColumnWithTypeAndName col_attribute_types{
std::make_shared<ColumnArray>(std::make_shared<ColumnString>()),
ColumnArray::create(ColumnString::create()),
std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()),
"attribute.types"
};
ColumnWithTypeAndName col_has_hierarchy{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "has_hierarchy"};
ColumnWithTypeAndName col_bytes_allocated{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "bytes_allocated"};
ColumnWithTypeAndName col_query_count{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "query_count"};
ColumnWithTypeAndName col_hit_rate{std::make_shared<ColumnFloat64>(), std::make_shared<DataTypeFloat64>(), "hit_rate"};
ColumnWithTypeAndName col_element_count{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "element_count"};
ColumnWithTypeAndName col_load_factor{std::make_shared<ColumnFloat64>(), std::make_shared<DataTypeFloat64>(), "load_factor"};
ColumnWithTypeAndName col_creation_time{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "creation_time"};
ColumnWithTypeAndName col_last_exception{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "last_exception"};
ColumnWithTypeAndName col_source{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "source"};
ColumnWithTypeAndName col_has_hierarchy{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "has_hierarchy"};
ColumnWithTypeAndName col_bytes_allocated{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "bytes_allocated"};
ColumnWithTypeAndName col_query_count{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "query_count"};
ColumnWithTypeAndName col_hit_rate{ColumnFloat64::create(), std::make_shared<DataTypeFloat64>(), "hit_rate"};
ColumnWithTypeAndName col_element_count{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "element_count"};
ColumnWithTypeAndName col_load_factor{ColumnFloat64::create(), std::make_shared<DataTypeFloat64>(), "load_factor"};
ColumnWithTypeAndName col_creation_time{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "creation_time"};
ColumnWithTypeAndName col_last_exception{ColumnString::create(), std::make_shared<DataTypeString>(), "last_exception"};
ColumnWithTypeAndName col_source{ColumnString::create(), std::make_shared<DataTypeString>(), "source"};
const auto & external_dictionaries = context.getExternalDictionaries();
auto objects_map = external_dictionaries.getObjectsMap();

View File

@ -34,8 +34,8 @@ BlockInputStreams StorageSystemFunctions::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithTypeAndName column_name{ std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name" };
ColumnWithTypeAndName column_is_aggregate{ std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_aggregate" };
ColumnWithTypeAndName column_name{ ColumnString::create(), std::make_shared<DataTypeString>(), "name" };
ColumnWithTypeAndName column_is_aggregate{ ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_aggregate" };
const auto & functions = FunctionFactory::instance().functions;
for (const auto & it : functions)

View File

@ -152,43 +152,43 @@ BlockInputStreams StorageSystemGraphite::read(
ColumnWithTypeAndName col_conf_name;
col_conf_name.name = "config_name";
col_conf_name.type = std::make_shared<DataTypeString>();
col_conf_name.column = std::make_shared<ColumnString>();
col_conf_name.column = ColumnString::create();
block.insert(col_conf_name);
ColumnWithTypeAndName col_regexp;
col_regexp.name = "regexp";
col_regexp.type = std::make_shared<DataTypeString>();
col_regexp.column = std::make_shared<ColumnString>();
col_regexp.column = ColumnString::create();
block.insert(col_regexp);
ColumnWithTypeAndName col_function;
col_function.name = "function";
col_function.type = std::make_shared<DataTypeString>();
col_function.column = std::make_shared<ColumnString>();
col_function.column = ColumnString::create();
block.insert(col_function);
ColumnWithTypeAndName col_age;
col_age.name = "age";
col_age.type = std::make_shared<DataTypeUInt64>();
col_age.column = std::make_shared<ColumnUInt64>();
col_age.column = ColumnUInt64::create();
block.insert(col_age);
ColumnWithTypeAndName col_precision;
col_precision.name = "precision";
col_precision.type = std::make_shared<DataTypeUInt64>();
col_precision.column = std::make_shared<ColumnUInt64>();
col_precision.column = ColumnUInt64::create();
block.insert(col_precision);
ColumnWithTypeAndName col_priority;
col_priority.name = "priority";
col_priority.type = std::make_shared<DataTypeUInt16>();
col_priority.column = std::make_shared<ColumnUInt16>();
col_priority.column = ColumnUInt16::create();
block.insert(col_priority);
ColumnWithTypeAndName col_is_default;
col_is_default.name = "is_default";
col_is_default.type = std::make_shared<DataTypeUInt8>();
col_is_default.column = std::make_shared<ColumnUInt8>();
col_is_default.column = ColumnUInt8::create();
block.insert(col_is_default);
const auto & config = context.getConfigRef();

View File

@ -38,13 +38,13 @@ BlockInputStreams StorageSystemMetrics::read(
ColumnWithTypeAndName col_metric;
col_metric.name = "metric";
col_metric.type = std::make_shared<DataTypeString>();
col_metric.column = std::make_shared<ColumnString>();
col_metric.column = ColumnString::create();
block.insert(col_metric);
ColumnWithTypeAndName col_value;
col_value.name = "value";
col_value.type = std::make_shared<DataTypeInt64>();
col_value.column = std::make_shared<ColumnInt64>();
col_value.column = ColumnInt64::create();
block.insert(col_value);
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)

View File

@ -35,12 +35,12 @@ BlockInputStreams StorageSystemModels::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_origin{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "origin"};
ColumnWithTypeAndName col_type{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "type"};
ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
ColumnWithTypeAndName col_origin{ColumnString::create(), std::make_shared<DataTypeString>(), "origin"};
ColumnWithTypeAndName col_type{ColumnString::create(), std::make_shared<DataTypeString>(), "type"};
ColumnWithTypeAndName col_creation_time{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "creation_time"};
ColumnWithTypeAndName col_last_exception{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "last_exception"};
ColumnWithTypeAndName col_creation_time{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "creation_time"};
ColumnWithTypeAndName col_last_exception{ColumnString::create(), std::make_shared<DataTypeString>(), "last_exception"};
const auto & external_models = context.getExternalModels();
auto objects_map = external_models.getObjectsMap();

View File

@ -27,7 +27,7 @@ protected:
column_with_type_and_name.name = "number";
column_with_type_and_name.type = std::make_shared<DataTypeUInt64>();
auto column = std::make_shared<ColumnUInt64>(block_size);
auto column = ColumnUInt64::create(block_size);
ColumnUInt64::Container_t & vec = column->getData();
column_with_type_and_name.column = column;

View File

@ -81,7 +81,7 @@ BlockInputStreams StorageSystemParts::read(
Databases databases = context.getDatabases();
/// Add column 'database'.
ColumnPtr database_column = std::make_shared<ColumnString>();
ColumnPtr database_column = ColumnString::create();
for (const auto & database : databases)
database_column->insert(database.first);
block_to_filter.insert(ColumnWithTypeAndName(database_column, std::make_shared<DataTypeString>(), "database"));
@ -97,9 +97,9 @@ BlockInputStreams StorageSystemParts::read(
size_t rows = database_column->size();
IColumn::Offsets_t offsets(rows);
ColumnPtr table_column = std::make_shared<ColumnString>();
ColumnPtr engine_column = std::make_shared<ColumnString>();
ColumnPtr active_column = std::make_shared<ColumnUInt8>();
ColumnPtr table_column = ColumnString::create();
ColumnPtr engine_column = ColumnString::create();
ColumnPtr active_column = ColumnUInt8::create();
for (size_t i = 0; i < rows; ++i)
{

View File

@ -80,9 +80,9 @@ BlockInputStreams StorageSystemReplicas::read(
}
}
ColumnWithTypeAndName col_database { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "database"};
ColumnWithTypeAndName col_table { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "table"};
ColumnWithTypeAndName col_engine { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "engine"};
ColumnWithTypeAndName col_database { ColumnString::create(), std::make_shared<DataTypeString>(), "database"};
ColumnWithTypeAndName col_table { ColumnString::create(), std::make_shared<DataTypeString>(), "table"};
ColumnWithTypeAndName col_engine { ColumnString::create(), std::make_shared<DataTypeString>(), "engine"};
for (auto & db : replicated_tables)
{
@ -108,29 +108,29 @@ BlockInputStreams StorageSystemReplicas::read(
col_engine = filtered_block.getByName("engine");
}
ColumnWithTypeAndName col_is_leader{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_leader"};
ColumnWithTypeAndName col_is_readonly{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_readonly"};
ColumnWithTypeAndName col_is_session_expired{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_session_expired"};
ColumnWithTypeAndName col_future_parts{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "future_parts"};
ColumnWithTypeAndName col_parts_to_check{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "parts_to_check"};
ColumnWithTypeAndName col_zookeeper_path{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "zookeeper_path"};
ColumnWithTypeAndName col_replica_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "replica_name"};
ColumnWithTypeAndName col_replica_path{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "replica_path"};
ColumnWithTypeAndName col_columns_version{std::make_shared<ColumnInt32>(), std::make_shared<DataTypeInt32>(), "columns_version"};
ColumnWithTypeAndName col_queue_size{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "queue_size"};
ColumnWithTypeAndName col_inserts_in_queue{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "inserts_in_queue"};
ColumnWithTypeAndName col_merges_in_queue{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "merges_in_queue"};
ColumnWithTypeAndName col_queue_oldest_time{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "queue_oldest_time"};
ColumnWithTypeAndName col_inserts_oldest_time{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "inserts_oldest_time"};
ColumnWithTypeAndName col_merges_oldest_time{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "merges_oldest_time"};
ColumnWithTypeAndName col_oldest_part_to_get{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "oldest_part_to_get"};
ColumnWithTypeAndName col_oldest_part_to_merge_to{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "oldest_part_to_merge_to"};
ColumnWithTypeAndName col_log_max_index{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "log_max_index"};
ColumnWithTypeAndName col_log_pointer{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "log_pointer"};
ColumnWithTypeAndName col_last_queue_update{std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "last_queue_update"};
ColumnWithTypeAndName col_absolute_delay{std::make_shared<ColumnUInt64>(), std::make_shared<DataTypeUInt64>(), "absolute_delay"};
ColumnWithTypeAndName col_total_replicas{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "total_replicas"};
ColumnWithTypeAndName col_active_replicas{std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "active_replicas"};
ColumnWithTypeAndName col_is_leader{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_leader"};
ColumnWithTypeAndName col_is_readonly{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_readonly"};
ColumnWithTypeAndName col_is_session_expired{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_session_expired"};
ColumnWithTypeAndName col_future_parts{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "future_parts"};
ColumnWithTypeAndName col_parts_to_check{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "parts_to_check"};
ColumnWithTypeAndName col_zookeeper_path{ColumnString::create(), std::make_shared<DataTypeString>(), "zookeeper_path"};
ColumnWithTypeAndName col_replica_name{ColumnString::create(), std::make_shared<DataTypeString>(), "replica_name"};
ColumnWithTypeAndName col_replica_path{ColumnString::create(), std::make_shared<DataTypeString>(), "replica_path"};
ColumnWithTypeAndName col_columns_version{ColumnInt32::create(), std::make_shared<DataTypeInt32>(), "columns_version"};
ColumnWithTypeAndName col_queue_size{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "queue_size"};
ColumnWithTypeAndName col_inserts_in_queue{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "inserts_in_queue"};
ColumnWithTypeAndName col_merges_in_queue{ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "merges_in_queue"};
ColumnWithTypeAndName col_queue_oldest_time{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "queue_oldest_time"};
ColumnWithTypeAndName col_inserts_oldest_time{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "inserts_oldest_time"};
ColumnWithTypeAndName col_merges_oldest_time{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "merges_oldest_time"};
ColumnWithTypeAndName col_oldest_part_to_get{ColumnString::create(), std::make_shared<DataTypeString>(), "oldest_part_to_get"};
ColumnWithTypeAndName col_oldest_part_to_merge_to{ColumnString::create(), std::make_shared<DataTypeString>(), "oldest_part_to_merge_to"};
ColumnWithTypeAndName col_log_max_index{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "log_max_index"};
ColumnWithTypeAndName col_log_pointer{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "log_pointer"};
ColumnWithTypeAndName col_last_queue_update{ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "last_queue_update"};
ColumnWithTypeAndName col_absolute_delay{ColumnUInt64::create(), std::make_shared<DataTypeUInt64>(), "absolute_delay"};
ColumnWithTypeAndName col_total_replicas{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "total_replicas"};
ColumnWithTypeAndName col_active_replicas{ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "active_replicas"};
for (size_t i = 0, size = col_database.column->size(); i < size; ++i)
{

View File

@ -64,8 +64,8 @@ BlockInputStreams StorageSystemReplicationQueue::read(
if (dynamic_cast<const StorageReplicatedMergeTree *>(iterator->table().get()))
replicated_tables[db.first][iterator->name()] = iterator->table();
ColumnWithTypeAndName col_database_to_filter { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "database" };
ColumnWithTypeAndName col_table_to_filter { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "table" };
ColumnWithTypeAndName col_database_to_filter { ColumnString::create(), std::make_shared<DataTypeString>(), "database" };
ColumnWithTypeAndName col_table_to_filter { ColumnString::create(), std::make_shared<DataTypeString>(), "table" };
for (auto & db : replicated_tables)
{
@ -89,26 +89,26 @@ BlockInputStreams StorageSystemReplicationQueue::read(
col_table_to_filter = filtered_block.getByName("table");
}
ColumnWithTypeAndName col_database { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "database" };
ColumnWithTypeAndName col_table { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "table" };
ColumnWithTypeAndName col_replica_name { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "replica_name" };
ColumnWithTypeAndName col_position { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "position" };
ColumnWithTypeAndName col_node_name { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "node_name" };
ColumnWithTypeAndName col_type { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "type" };
ColumnWithTypeAndName col_create_time { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "create_time" };
ColumnWithTypeAndName col_required_quorum { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "required_quorum" };
ColumnWithTypeAndName col_source_replica { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "source_replica" };
ColumnWithTypeAndName col_new_part_name { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "new_part_name" };
ColumnWithTypeAndName col_parts_to_merge { std::make_shared<ColumnArray>(std::make_shared<ColumnString>()),
ColumnWithTypeAndName col_database { ColumnString::create(), std::make_shared<DataTypeString>(), "database" };
ColumnWithTypeAndName col_table { ColumnString::create(), std::make_shared<DataTypeString>(), "table" };
ColumnWithTypeAndName col_replica_name { ColumnString::create(), std::make_shared<DataTypeString>(), "replica_name" };
ColumnWithTypeAndName col_position { ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "position" };
ColumnWithTypeAndName col_node_name { ColumnString::create(), std::make_shared<DataTypeString>(), "node_name" };
ColumnWithTypeAndName col_type { ColumnString::create(), std::make_shared<DataTypeString>(), "type" };
ColumnWithTypeAndName col_create_time { ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "create_time" };
ColumnWithTypeAndName col_required_quorum { ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "required_quorum" };
ColumnWithTypeAndName col_source_replica { ColumnString::create(), std::make_shared<DataTypeString>(), "source_replica" };
ColumnWithTypeAndName col_new_part_name { ColumnString::create(), std::make_shared<DataTypeString>(), "new_part_name" };
ColumnWithTypeAndName col_parts_to_merge { ColumnArray::create(ColumnString::create()),
std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()), "parts_to_merge" };
ColumnWithTypeAndName col_is_detach { std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_detach" };
ColumnWithTypeAndName col_is_currently_executing { std::make_shared<ColumnUInt8>(), std::make_shared<DataTypeUInt8>(), "is_currently_executing" };
ColumnWithTypeAndName col_num_tries { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "num_tries" };
ColumnWithTypeAndName col_last_exception { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "last_exception" };
ColumnWithTypeAndName col_last_attempt_time { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "last_attempt_time" };
ColumnWithTypeAndName col_num_postponed { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeUInt32>(), "num_postponed" };
ColumnWithTypeAndName col_postpone_reason { std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "postpone_reason" };
ColumnWithTypeAndName col_last_postpone_time { std::make_shared<ColumnUInt32>(), std::make_shared<DataTypeDateTime>(), "last_postpone_time" };
ColumnWithTypeAndName col_is_detach { ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_detach" };
ColumnWithTypeAndName col_is_currently_executing { ColumnUInt8::create(), std::make_shared<DataTypeUInt8>(), "is_currently_executing" };
ColumnWithTypeAndName col_num_tries { ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "num_tries" };
ColumnWithTypeAndName col_last_exception { ColumnString::create(), std::make_shared<DataTypeString>(), "last_exception" };
ColumnWithTypeAndName col_last_attempt_time { ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "last_attempt_time" };
ColumnWithTypeAndName col_num_postponed { ColumnUInt32::create(), std::make_shared<DataTypeUInt32>(), "num_postponed" };
ColumnWithTypeAndName col_postpone_reason { ColumnString::create(), std::make_shared<DataTypeString>(), "postpone_reason" };
ColumnWithTypeAndName col_last_postpone_time { ColumnUInt32::create(), std::make_shared<DataTypeDateTime>(), "last_postpone_time" };
StorageReplicatedMergeTree::LogEntriesData queue;
String replica_name;

Some files were not shown because too many files have changed in this diff Show More