[Enchancement](function) refact and optimize some function register (#16955)
refact and optimize some function register
This commit is contained in:
@ -45,25 +45,8 @@ template <template <typename> class Function>
|
||||
AggregateFunctionPtr create_aggregate_function_sum(const std::string& name,
|
||||
const DataTypes& argument_types,
|
||||
const bool result_is_nullable) {
|
||||
AggregateFunctionPtr res;
|
||||
DataTypePtr data_type = argument_types[0];
|
||||
if (data_type->is_nullable()) {
|
||||
auto no_null_argument_types = remove_nullable(argument_types);
|
||||
if (is_decimal(no_null_argument_types[0])) {
|
||||
res.reset(create_with_decimal_type_null<Function>(
|
||||
no_null_argument_types, *no_null_argument_types[0], no_null_argument_types));
|
||||
} else {
|
||||
res.reset(create_with_numeric_type_null<Function>(no_null_argument_types,
|
||||
no_null_argument_types));
|
||||
}
|
||||
} else {
|
||||
if (is_decimal(data_type)) {
|
||||
res.reset(create_with_decimal_type<Function>(*data_type, *data_type, argument_types));
|
||||
} else {
|
||||
res.reset(create_with_numeric_type<Function>(*data_type, argument_types));
|
||||
}
|
||||
}
|
||||
|
||||
AggregateFunctionPtr res(
|
||||
creator_with_type::create<Function>(result_is_nullable, argument_types));
|
||||
if (!res) {
|
||||
LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate function {}",
|
||||
argument_types[0]->get_name(), name);
|
||||
|
||||
Reference in New Issue
Block a user