diff --git a/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp b/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp index 1a8588f5af8..71eb3e8c7da 100644 --- a/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp +++ b/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp @@ -74,7 +74,7 @@ namespace /// groupBitmap needs to know about the data type that was used to create bitmaps. /// We need to look inside the type of its argument to obtain it. const DataTypeAggregateFunction & datatype_aggfunc = dynamic_cast(*argument_type_ptr); - ConstAggregateFunctionPtr aggfunc = datatype_aggfunc.getFunction(); + AggregateFunctionPtr aggfunc = datatype_aggfunc.getFunction(); if (aggfunc->getName() != AggregateFunctionGroupBitmapData::name()) throw Exception( diff --git a/src/AggregateFunctions/IAggregateFunction.h b/src/AggregateFunctions/IAggregateFunction.h index 602c2bb661e..1df5b67b155 100644 --- a/src/AggregateFunctions/IAggregateFunction.h +++ b/src/AggregateFunctions/IAggregateFunction.h @@ -49,8 +49,7 @@ using AggregateDataPtr = char *; using ConstAggregateDataPtr = const char *; class IAggregateFunction; -using AggregateFunctionPtr = std::shared_ptr; -using ConstAggregateFunctionPtr = std::shared_ptr; +using AggregateFunctionPtr = std::shared_ptr; struct AggregateFunctionProperties; diff --git a/src/Analyzer/FunctionNode.cpp b/src/Analyzer/FunctionNode.cpp index 607243b620d..36e4f1fc69b 100644 --- a/src/Analyzer/FunctionNode.cpp +++ b/src/Analyzer/FunctionNode.cpp @@ -40,12 +40,12 @@ ColumnsWithTypeAndName FunctionNode::getArgumentTypes() const FunctionBasePtr FunctionNode::getFunction() const { - return std::dynamic_pointer_cast(function); + return std::dynamic_pointer_cast(function); } AggregateFunctionPtr FunctionNode::getAggregateFunction() const { - return std::dynamic_pointer_cast(function); + return std::dynamic_pointer_cast(function); } bool FunctionNode::isAggregateFunction() const diff --git a/src/Analyzer/FunctionNode.h b/src/Analyzer/FunctionNode.h index 99c8d904cfb..3a8c5445375 100644 --- a/src/Analyzer/FunctionNode.h +++ b/src/Analyzer/FunctionNode.h @@ -15,10 +15,10 @@ class IFunctionOverloadResolver; using FunctionOverloadResolverPtr = std::shared_ptr; class IFunctionBase; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; class IAggregateFunction; -using AggregateFunctionPtr = std::shared_ptr; +using AggregateFunctionPtr = std::shared_ptr; /** Function node represents function in query tree. * Function syntax: function_name(parameter_1, ...)(argument_1, ...). diff --git a/src/Columns/ColumnAggregateFunction.cpp b/src/Columns/ColumnAggregateFunction.cpp index f80955646a3..58643f7a9b7 100644 --- a/src/Columns/ColumnAggregateFunction.cpp +++ b/src/Columns/ColumnAggregateFunction.cpp @@ -28,7 +28,7 @@ namespace ErrorCodes } -static String getTypeString(const ConstAggregateFunctionPtr & func, std::optional version = std::nullopt) +static String getTypeString(const AggregateFunctionPtr & func, std::optional version = std::nullopt) { WriteBufferFromOwnString stream; @@ -62,18 +62,18 @@ static String getTypeString(const ConstAggregateFunctionPtr & func, std::optiona } -ColumnAggregateFunction::ColumnAggregateFunction(const ConstAggregateFunctionPtr & func_, std::optional version_) +ColumnAggregateFunction::ColumnAggregateFunction(const AggregateFunctionPtr & func_, std::optional version_) : func(func_), type_string(getTypeString(func, version_)), version(version_) { } -ColumnAggregateFunction::ColumnAggregateFunction(const ConstAggregateFunctionPtr & func_, const ConstArenas & arenas_) +ColumnAggregateFunction::ColumnAggregateFunction(const AggregateFunctionPtr & func_, const ConstArenas & arenas_) : foreign_arenas(arenas_), func(func_), type_string(getTypeString(func)) { } -void ColumnAggregateFunction::set(const ConstAggregateFunctionPtr & func_, size_t version_) +void ColumnAggregateFunction::set(const AggregateFunctionPtr & func_, size_t version_) { func = func_; version = version_; diff --git a/src/Columns/ColumnAggregateFunction.h b/src/Columns/ColumnAggregateFunction.h index 90bfdc581c1..1c46c60a16d 100644 --- a/src/Columns/ColumnAggregateFunction.h +++ b/src/Columns/ColumnAggregateFunction.h @@ -70,7 +70,7 @@ private: ArenaPtr my_arena; /// Used for destroying states and for finalization of values. - ConstAggregateFunctionPtr func; + AggregateFunctionPtr func; /// Source column. Used (holds source from destruction), /// if this column has been constructed from another and uses all or part of its values. @@ -92,9 +92,9 @@ private: /// Create a new column that has another column as a source. MutablePtr createView() const; - explicit ColumnAggregateFunction(const ConstAggregateFunctionPtr & func_, std::optional version_ = std::nullopt); + explicit ColumnAggregateFunction(const AggregateFunctionPtr & func_, std::optional version_ = std::nullopt); - ColumnAggregateFunction(const ConstAggregateFunctionPtr & func_, const ConstArenas & arenas_); + ColumnAggregateFunction(const AggregateFunctionPtr & func_, const ConstArenas & arenas_); ColumnAggregateFunction(const ColumnAggregateFunction & src_); @@ -103,10 +103,10 @@ private: public: ~ColumnAggregateFunction() override; - void set(const ConstAggregateFunctionPtr & func_, size_t version_); + void set(const AggregateFunctionPtr & func_, size_t version_); - ConstAggregateFunctionPtr getAggregateFunction() { return func; } - ConstAggregateFunctionPtr getAggregateFunction() const { return func; } + AggregateFunctionPtr getAggregateFunction() { return func; } + AggregateFunctionPtr getAggregateFunction() const { return func; } /// If we have another column as a source (owner of data), copy all data to ourself and reset source. /// This is needed before inserting new elements, because we must own these elements (to destroy them in destructor), diff --git a/src/Columns/ColumnFunction.h b/src/Columns/ColumnFunction.h index 4781406c3b9..257bd1146fd 100644 --- a/src/Columns/ColumnFunction.h +++ b/src/Columns/ColumnFunction.h @@ -13,7 +13,7 @@ namespace ErrorCodes } class IFunctionBase; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; /** A column containing a lambda expression. * Behaves like a constant-column. Contains an expression, but not input or output data. diff --git a/src/Core/IResolvedFunction.h b/src/Core/IResolvedFunction.h index fe15f39615b..64c69f597c7 100644 --- a/src/Core/IResolvedFunction.h +++ b/src/Core/IResolvedFunction.h @@ -24,6 +24,6 @@ public: virtual ~IResolvedFunction() = default; }; -using IResolvedFunctionPtr = std::shared_ptr; +using IResolvedFunctionPtr = std::shared_ptr; } diff --git a/src/DataTypes/DataTypeAggregateFunction.h b/src/DataTypes/DataTypeAggregateFunction.h index 50d3fb6375f..2d712d9c686 100644 --- a/src/DataTypes/DataTypeAggregateFunction.h +++ b/src/DataTypes/DataTypeAggregateFunction.h @@ -19,7 +19,7 @@ namespace DB class DataTypeAggregateFunction final : public IDataType { private: - ConstAggregateFunctionPtr function; + AggregateFunctionPtr function; DataTypes argument_types; Array parameters; mutable std::optional version; @@ -30,7 +30,7 @@ private: public: static constexpr bool is_parametric = true; - DataTypeAggregateFunction(ConstAggregateFunctionPtr function_, const DataTypes & argument_types_, + DataTypeAggregateFunction(AggregateFunctionPtr function_, const DataTypes & argument_types_, const Array & parameters_, std::optional version_ = std::nullopt) : function(std::move(function_)) , argument_types(argument_types_) @@ -40,7 +40,7 @@ public: } String getFunctionName() const { return function->getName(); } - ConstAggregateFunctionPtr getFunction() const { return function; } + AggregateFunctionPtr getFunction() const { return function; } String doGetName() const override; String getNameWithoutVersion() const; diff --git a/src/DataTypes/Serializations/SerializationAggregateFunction.cpp b/src/DataTypes/Serializations/SerializationAggregateFunction.cpp index 39305ad4bcb..7e192595114 100644 --- a/src/DataTypes/Serializations/SerializationAggregateFunction.cpp +++ b/src/DataTypes/Serializations/SerializationAggregateFunction.cpp @@ -108,14 +108,14 @@ void SerializationAggregateFunction::deserializeBinaryBulk(IColumn & column, Rea } } -static String serializeToString(const ConstAggregateFunctionPtr & function, const IColumn & column, size_t row_num, size_t version) +static String serializeToString(const AggregateFunctionPtr & function, const IColumn & column, size_t row_num, size_t version) { WriteBufferFromOwnString buffer; function->serialize(assert_cast(column).getData()[row_num], buffer, version); return buffer.str(); } -static void deserializeFromString(const ConstAggregateFunctionPtr & function, IColumn & column, const String & s, size_t version) +static void deserializeFromString(const AggregateFunctionPtr & function, IColumn & column, const String & s, size_t version) { ColumnAggregateFunction & column_concrete = assert_cast(column); diff --git a/src/DataTypes/Serializations/SerializationAggregateFunction.h b/src/DataTypes/Serializations/SerializationAggregateFunction.h index a3a427f1b2d..4212298bbc1 100644 --- a/src/DataTypes/Serializations/SerializationAggregateFunction.h +++ b/src/DataTypes/Serializations/SerializationAggregateFunction.h @@ -11,14 +11,14 @@ namespace DB class SerializationAggregateFunction final : public ISerialization { private: - ConstAggregateFunctionPtr function; + AggregateFunctionPtr function; String type_name; size_t version; public: static constexpr bool is_parametric = true; - SerializationAggregateFunction(const ConstAggregateFunctionPtr & function_, String type_name_, size_t version_) + SerializationAggregateFunction(const AggregateFunctionPtr & function_, String type_name_, size_t version_) : function(function_), type_name(std::move(type_name_)), version(version_) {} /// NOTE These two functions for serializing single values are incompatible with the functions below. diff --git a/src/Formats/ProtobufSerializer.cpp b/src/Formats/ProtobufSerializer.cpp index 88febc5a090..48332deedfb 100644 --- a/src/Formats/ProtobufSerializer.cpp +++ b/src/Formats/ProtobufSerializer.cpp @@ -1736,7 +1736,7 @@ namespace } const std::shared_ptr aggregate_function_data_type; - ConstAggregateFunctionPtr aggregate_function; + AggregateFunctionPtr aggregate_function; String text_buffer; }; diff --git a/src/Functions/FunctionBinaryArithmetic.h b/src/Functions/FunctionBinaryArithmetic.h index 7eaecc10597..0a79ac3b0d9 100644 --- a/src/Functions/FunctionBinaryArithmetic.h +++ b/src/Functions/FunctionBinaryArithmetic.h @@ -895,7 +895,7 @@ class FunctionBinaryArithmetic : public IFunction const ColumnAggregateFunction & column = typeid_cast( agg_state_is_const ? assert_cast(agg_state_column).getDataColumn() : agg_state_column); - ConstAggregateFunctionPtr function = column.getAggregateFunction(); + AggregateFunctionPtr function = column.getAggregateFunction(); size_t size = agg_state_is_const ? 1 : input_rows_count; @@ -960,7 +960,7 @@ class FunctionBinaryArithmetic : public IFunction const ColumnAggregateFunction & rhs = typeid_cast( rhs_is_const ? assert_cast(rhs_column).getDataColumn() : rhs_column); - ConstAggregateFunctionPtr function = lhs.getAggregateFunction(); + AggregateFunctionPtr function = lhs.getAggregateFunction(); size_t size = (lhs_is_const && rhs_is_const) ? 1 : input_rows_count; diff --git a/src/Functions/IFunction.h b/src/Functions/IFunction.h index 96427030684..e82b98f0084 100644 --- a/src/Functions/IFunction.h +++ b/src/Functions/IFunction.h @@ -285,7 +285,7 @@ public: }; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; /** Creates IFunctionBase from argument types list (chooses one function overload). diff --git a/src/Functions/runningAccumulate.cpp b/src/Functions/runningAccumulate.cpp index bdb497c029c..a72f97db9a6 100644 --- a/src/Functions/runningAccumulate.cpp +++ b/src/Functions/runningAccumulate.cpp @@ -91,7 +91,7 @@ public: if (arguments.size() == 2) column_with_groups = arguments[1].column; - ConstAggregateFunctionPtr aggregate_function_ptr = column_with_states->getAggregateFunction(); + AggregateFunctionPtr aggregate_function_ptr = column_with_states->getAggregateFunction(); const IAggregateFunction & agg_func = *aggregate_function_ptr; AlignedBuffer place(agg_func.sizeOfData(), agg_func.alignOfData()); diff --git a/src/Interpreters/ActionsDAG.h b/src/Interpreters/ActionsDAG.h index bab6467729f..a1316c5ff11 100644 --- a/src/Interpreters/ActionsDAG.h +++ b/src/Interpreters/ActionsDAG.h @@ -17,7 +17,7 @@ class IExecutableFunction; using ExecutableFunctionPtr = std::shared_ptr; class IFunctionBase; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; class IFunctionOverloadResolver; using FunctionOverloadResolverPtr = std::shared_ptr; diff --git a/src/Interpreters/ExpressionJIT.cpp b/src/Interpreters/ExpressionJIT.cpp index 3a2c2e333a9..e32f8eeab57 100644 --- a/src/Interpreters/ExpressionJIT.cpp +++ b/src/Interpreters/ExpressionJIT.cpp @@ -263,7 +263,7 @@ public: return result; } - static void applyFunction(IFunctionBase & function, Field & value) + static void applyFunction(const IFunctionBase & function, Field & value) { const auto & type = function.getArgumentTypes().at(0); ColumnsWithTypeAndName args{{type->createColumnConst(1, value), type, "x" }}; diff --git a/src/Interpreters/Set.h b/src/Interpreters/Set.h index 44f543ce222..bafb0dcea7a 100644 --- a/src/Interpreters/Set.h +++ b/src/Interpreters/Set.h @@ -18,7 +18,7 @@ struct Range; class Context; class IFunctionBase; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; class Chunk; diff --git a/src/Storages/MergeTree/KeyCondition.cpp b/src/Storages/MergeTree/KeyCondition.cpp index 491fcba6d7b..7688fad5311 100644 --- a/src/Storages/MergeTree/KeyCondition.cpp +++ b/src/Storages/MergeTree/KeyCondition.cpp @@ -945,7 +945,7 @@ bool KeyCondition::transformConstantWithValidFunctions( DataTypePtr & out_key_column_type, Field & out_value, DataTypePtr & out_type, - std::function always_monotonic) const + std::function always_monotonic) const { const auto & sample_block = key_expr->getSampleBlock(); @@ -1076,7 +1076,7 @@ bool KeyCondition::canConstantBeWrappedByMonotonicFunctions( out_key_column_type, out_value, out_type, - [](IFunctionBase & func, const IDataType & type) + [](const IFunctionBase & func, const IDataType & type) { if (!func.hasInformationAboutMonotonicity()) return false; @@ -1131,7 +1131,7 @@ bool KeyCondition::canConstantBeWrappedByFunctions( out_key_column_type, out_value, out_type, - [](IFunctionBase & func, const IDataType &) + [](const IFunctionBase & func, const IDataType &) { return func.isDeterministic(); }); diff --git a/src/Storages/MergeTree/KeyCondition.h b/src/Storages/MergeTree/KeyCondition.h index 5c0d001bc10..ca9f4a4aea0 100644 --- a/src/Storages/MergeTree/KeyCondition.h +++ b/src/Storages/MergeTree/KeyCondition.h @@ -19,7 +19,7 @@ namespace DB class ASTFunction; class Context; class IFunction; -using FunctionBasePtr = std::shared_ptr; +using FunctionBasePtr = std::shared_ptr; class ExpressionActions; using ExpressionActionsPtr = std::shared_ptr; struct ActionDAGNodes; @@ -427,7 +427,7 @@ private: DataTypePtr & out_key_column_type, Field & out_value, DataTypePtr & out_type, - std::function always_monotonic) const; + std::function always_monotonic) const; bool canConstantBeWrappedByMonotonicFunctions( const RPNBuilderTreeNode & node, diff --git a/src/Storages/TTLDescription.cpp b/src/Storages/TTLDescription.cpp index 41c9c1996b1..2971d977099 100644 --- a/src/Storages/TTLDescription.cpp +++ b/src/Storages/TTLDescription.cpp @@ -61,7 +61,7 @@ void checkTTLExpression(const ExpressionActionsPtr & ttl_expression, const Strin { if (action.node->type == ActionsDAG::ActionType::FUNCTION) { - IFunctionBase & func = *action.node->function_base; + const IFunctionBase & func = *action.node->function_base; if (!func.isDeterministic()) throw Exception( "TTL expression cannot contain non-deterministic functions, "