Coverage Report

Created: 2026-03-16 21:03

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_regr_union.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "exprs/aggregate/aggregate_function_regr_union.h"
19
20
#include "core/data_type/data_type.h"
21
#include "exprs/aggregate/aggregate_function.h"
22
#include "exprs/aggregate/aggregate_function_simple_factory.h"
23
#include "exprs/aggregate/helpers.h"
24
25
namespace doris {
26
#include "common/compile_check_begin.h"
27
28
template <template <PrimitiveType> class StatFunctionTemplate>
29
AggregateFunctionPtr create_aggregate_function_regr(const std::string& name,
30
                                                    const DataTypes& argument_types,
31
                                                    const DataTypePtr& result_type,
32
                                                    const bool result_is_nullable,
33
0
                                                    const AggregateFunctionAttr& attr) {
34
0
    bool y_nullable_input = argument_types[0]->is_nullable();
35
0
    bool x_nullable_input = argument_types[1]->is_nullable();
36
0
    if (y_nullable_input) {
37
0
        if (x_nullable_input) {
38
0
            return creator_without_type::create_ignore_nullable<
39
0
                    AggregateFunctionRegrSimple<StatFunctionTemplate<TYPE_DOUBLE>, true, true>>(
40
0
                    argument_types, result_is_nullable, attr);
41
0
        } else {
42
0
            return creator_without_type::create_ignore_nullable<
43
0
                    AggregateFunctionRegrSimple<StatFunctionTemplate<TYPE_DOUBLE>, true, false>>(
44
0
                    argument_types, result_is_nullable, attr);
45
0
        }
46
0
    } else {
47
0
        if (x_nullable_input) {
48
0
            return creator_without_type::create_ignore_nullable<
49
0
                    AggregateFunctionRegrSimple<StatFunctionTemplate<TYPE_DOUBLE>, false, true>>(
50
0
                    argument_types, result_is_nullable, attr);
51
0
        } else {
52
0
            return creator_without_type::create_ignore_nullable<
53
0
                    AggregateFunctionRegrSimple<StatFunctionTemplate<TYPE_DOUBLE>, false, false>>(
54
0
                    argument_types, result_is_nullable, attr);
55
0
        }
56
0
    }
57
0
}
Unexecuted instantiation: _ZN5doris30create_aggregate_function_regrINS_13RegrSlopeFuncEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE
Unexecuted instantiation: _ZN5doris30create_aggregate_function_regrINS_17RegrInterceptFuncEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE
Unexecuted instantiation: _ZN5doris30create_aggregate_function_regrINS_11RegrSxxFuncEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE
Unexecuted instantiation: _ZN5doris30create_aggregate_function_regrINS_11RegrSyyFuncEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE
Unexecuted instantiation: _ZN5doris30create_aggregate_function_regrINS_11RegrSxyFuncEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE
58
59
1
void register_aggregate_function_regr_union(AggregateFunctionSimpleFactory& factory) {
60
1
    factory.register_function_both("regr_slope", create_aggregate_function_regr<RegrSlopeFunc>);
61
1
    factory.register_function_both("regr_intercept",
62
1
                                   create_aggregate_function_regr<RegrInterceptFunc>);
63
1
    factory.register_function_both("regr_sxx", create_aggregate_function_regr<RegrSxxFunc>);
64
1
    factory.register_function_both("regr_syy", create_aggregate_function_regr<RegrSyyFunc>);
65
1
    factory.register_function_both("regr_sxy", create_aggregate_function_regr<RegrSxyFunc>);
66
1
}
67
} // namespace doris