mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Attempt to make compositions with COWPtr more convenient
This commit is contained in:
parent
fb19cf1eec
commit
67b6a8966b
@ -67,10 +67,10 @@ struct UniqVariadicHash<false, true>
|
||||
{
|
||||
UInt64 hash;
|
||||
|
||||
const Columns & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
const auto & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
|
||||
const ColumnPtr * column = tuple_columns.data();
|
||||
const ColumnPtr * columns_end = column + num_args;
|
||||
const auto * column = tuple_columns.data();
|
||||
const auto * columns_end = column + num_args;
|
||||
|
||||
{
|
||||
StringRef value = column->get()->getDataAt(row_num);
|
||||
@ -116,10 +116,10 @@ struct UniqVariadicHash<true, true>
|
||||
{
|
||||
static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||
{
|
||||
const Columns & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
const auto & tuple_columns = static_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||
|
||||
const ColumnPtr * column = tuple_columns.data();
|
||||
const ColumnPtr * columns_end = column + num_args;
|
||||
const auto * column = tuple_columns.data();
|
||||
const auto * columns_end = column + num_args;
|
||||
|
||||
SipHash hash;
|
||||
|
||||
|
@ -58,6 +58,18 @@ ColumnTuple::Ptr ColumnTuple::create(const Columns & columns)
|
||||
return column_tuple;
|
||||
}
|
||||
|
||||
ColumnTuple::Ptr ColumnTuple::create(const TupleColumns & columns)
|
||||
{
|
||||
for (const auto & column : columns)
|
||||
if (column->isColumnConst())
|
||||
throw Exception{"ColumnTuple cannot have ColumnConst as its element", ErrorCodes::ILLEGAL_COLUMN};
|
||||
|
||||
auto column_tuple = ColumnTuple::create(MutableColumns());
|
||||
column_tuple->columns = columns;
|
||||
|
||||
return column_tuple;
|
||||
}
|
||||
|
||||
MutableColumnPtr ColumnTuple::cloneEmpty() const
|
||||
{
|
||||
const size_t tuple_size = columns.size();
|
||||
|
Loading…
Reference in New Issue
Block a user