diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp index 2c22586d43..3083b9c7b1 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp @@ -18,28 +18,21 @@ #include "vec/aggregate_functions/aggregate_function_approx_count_distinct.h" #include "vec/aggregate_functions/helpers.h" -#include "vec/utils/template_helpers.hpp" namespace doris::vectorized { AggregateFunctionPtr create_aggregate_function_approx_count_distinct( const std::string& name, const DataTypes& argument_types, const bool result_is_nullable) { - AggregateFunctionPtr res = nullptr; WhichDataType which(remove_nullable(argument_types[0])); -#define DISPATCH(TYPE, COLUMN_TYPE) \ - if (which.idx == TypeIndex::TYPE) \ - res.reset(creator_without_type::create>( \ - result_is_nullable, argument_types)); +#define DISPATCH(TYPE, COLUMN_TYPE) \ + if (which.idx == TypeIndex::TYPE) \ + return creator_without_type::create>( \ + argument_types, result_is_nullable); TYPE_TO_COLUMN_TYPE(DISPATCH) #undef DISPATCH - if (!res) { - LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate function {}", - argument_types[0]->get_name(), name); - } - - return res; + return nullptr; } void register_aggregate_function_approx_count_distinct(AggregateFunctionSimpleFactory& factory) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp b/be/src/vec/aggregate_functions/aggregate_function_avg.cpp index 4f493c9529..f6fe08a9e3 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_avg.cpp @@ -20,9 +20,7 @@ #include "vec/aggregate_functions/aggregate_function_avg.h" -#include "common/logging.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/factory_helpers.h" #include "vec/aggregate_functions/helpers.h" namespace doris::vectorized { @@ -36,22 +34,7 @@ struct Avg { template using AggregateFuncAvg = typename Avg::Function; -AggregateFunctionPtr create_aggregate_function_avg(const std::string& name, - const DataTypes& argument_types, - const bool result_is_nullable) { - assert_unary(name, argument_types); - - AggregateFunctionPtr res( - creator_with_type::create(result_is_nullable, argument_types)); - - if (!res) { - LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate function {}", - argument_types[0]->get_name(), name); - } - return res; -} - void register_aggregate_function_avg(AggregateFunctionSimpleFactory& factory) { - factory.register_function_both("avg", create_aggregate_function_avg); + factory.register_function_both("avg", creator_with_type::creator); } } // namespace doris::vectorized diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp b/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp index c81bf4b42f..fc5df5303f 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp @@ -19,18 +19,10 @@ #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type_nullable.h" namespace doris::vectorized { - -AggregateFunctionPtr create_aggregate_function_avg_weight(const std::string& name, - const DataTypes& argument_types, - const bool result_is_nullable) { - return AggregateFunctionPtr(creator_with_type::create( - result_is_nullable, argument_types)); -} - void register_aggregate_function_avg_weighted(AggregateFunctionSimpleFactory& factory) { - factory.register_function_both("avg_weighted", create_aggregate_function_avg_weight); + factory.register_function_both("avg_weighted", + creator_with_type::creator); } } // namespace doris::vectorized diff --git a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp b/be/src/vec/aggregate_functions/aggregate_function_bit.cpp index bdc51daaf9..97a6c0e92f 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_bit.cpp @@ -25,28 +25,16 @@ namespace doris::vectorized { -template