diff --git a/base/base/wide_integer_impl.h b/base/base/wide_integer_impl.h index cffffcc213f..ec146fd5821 100644 --- a/base/base/wide_integer_impl.h +++ b/base/base/wide_integer_impl.h @@ -125,11 +125,11 @@ public: template struct common_type, wide::integer> { - using type = std::conditional_t < Bits == Bits2, - wide::integer< - Bits, - std::conditional_t<(std::is_same_v && std::is_same_v), signed, unsigned>>, - std::conditional_t, wide::integer>>; + using type = std::conditional_t && std::is_same_v), signed, unsigned>>, + std::conditional_t, wide::integer>>; }; template diff --git a/src/Columns/ColumnFunction.cpp b/src/Columns/ColumnFunction.cpp index 09a3dbad242..9791ffb8181 100644 --- a/src/Columns/ColumnFunction.cpp +++ b/src/Columns/ColumnFunction.cpp @@ -3,9 +3,11 @@ #include #include #include +#include #include #include + namespace ProfileEvents { extern const Event FunctionExecute; @@ -59,6 +61,34 @@ ColumnPtr ColumnFunction::cut(size_t start, size_t length) const return ColumnFunction::create(length, function, capture, is_short_circuit_argument, is_function_compiled); } +void ColumnFunction::insertFrom(const IColumn & src, size_t n) +{ + const ColumnFunction & src_func = assert_cast(src); + + for (size_t i = 0, size = captured_columns.size(); i < size; ++i) + { + auto mut_column = IColumn::mutate(std::move(captured_columns[i].column)); + mut_column->insertFrom(*src_func.captured_columns[i].column, n); + captured_columns[i].column = std::move(mut_column); + } + + ++size_; +} + +void ColumnFunction::insertRangeFrom(const IColumn & src, size_t start, size_t length) +{ + const ColumnFunction & src_func = assert_cast(src); + + for (size_t i = 0, size = captured_columns.size(); i < size; ++i) + { + auto mut_column = IColumn::mutate(std::move(captured_columns[i].column)); + mut_column->insertRangeFrom(*src_func.captured_columns[i].column, start, length); + captured_columns[i].column = std::move(mut_column); + } + + size_ += length; +} + ColumnPtr ColumnFunction::filter(const Filter & filt, ssize_t result_size_hint) const { if (size_ != filt.size()) diff --git a/src/Columns/ColumnFunction.h b/src/Columns/ColumnFunction.h index 2592dc01f98..5b410a28ddf 100644 --- a/src/Columns/ColumnFunction.h +++ b/src/Columns/ColumnFunction.h @@ -88,10 +88,8 @@ public: throw Exception("Cannot insert into " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertRangeFrom(const IColumn &, size_t, size_t) override - { - throw Exception("Cannot insert into " + getName(), ErrorCodes::NOT_IMPLEMENTED); - } + void insertFrom(const IColumn & src, size_t n) override; + void insertRangeFrom(const IColumn &, size_t start, size_t length) override; void insertData(const char *, size_t) override {