diff --git a/be/src/vec/aggregate_functions/aggregate_function_regr_union.cpp b/be/src/vec/aggregate_functions/aggregate_function_regr_union.cpp new file mode 100644 index 00000000000000..738d777441c360 --- /dev/null +++ b/be/src/vec/aggregate_functions/aggregate_function_regr_union.cpp @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "vec/aggregate_functions/aggregate_function_regr_union.h" + +#include "common/status.h" +#include "vec/aggregate_functions/aggregate_function.h" +#include "vec/aggregate_functions/aggregate_function_simple_factory.h" +#include "vec/aggregate_functions/helpers.h" +#include "vec/core/types.h" +#include "vec/data_types/data_type.h" +#include "vec/data_types/data_type_nullable.h" + +namespace doris::vectorized { + +template class StatFunctionTemplate> +AggregateFunctionPtr type_dispatch_for_aggregate_function_regr(const DataTypes& argument_types, + const bool& result_is_nullable, + bool y_nullable_input, + bool x_nullable_input) { + if (y_nullable_input) { + if (x_nullable_input) { + return creator_without_type::create_ignore_nullable< + AggregateFunctionRegrSimple, true, true>>( + argument_types, result_is_nullable); + } else { + return creator_without_type::create_ignore_nullable< + AggregateFunctionRegrSimple, true, false>>( + argument_types, result_is_nullable); + } + } else { + if (x_nullable_input) { + return creator_without_type::create_ignore_nullable< + AggregateFunctionRegrSimple, false, true>>( + argument_types, result_is_nullable); + } else { + return creator_without_type::create_ignore_nullable< + AggregateFunctionRegrSimple, false, false>>( + argument_types, result_is_nullable); + } + } +} + +template