Coverage Report

Created: 2026-04-13 11:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_covar.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_covar.h"
19
20
#include "core/data_type/data_type.h"
21
#include "exprs/aggregate/aggregate_function_simple_factory.h"
22
#include "exprs/aggregate/helpers.h"
23
24
namespace doris {
25
26
template <template <typename> class Function, template <PrimitiveType> class Data>
27
AggregateFunctionPtr create_function_single_value(const String& name,
28
                                                  const DataTypes& argument_types,
29
                                                  const bool result_is_nullable,
30
777
                                                  const AggregateFunctionAttr& attr) {
31
777
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
32
777
                                                                       result_is_nullable, attr);
33
777
}
_ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_8SampDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE
Line
Count
Source
30
390
                                                  const AggregateFunctionAttr& attr) {
31
390
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
32
390
                                                                       result_is_nullable, attr);
33
390
}
_ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_7PopDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE
Line
Count
Source
30
387
                                                  const AggregateFunctionAttr& attr) {
31
387
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
32
387
                                                                       result_is_nullable, attr);
33
387
}
34
35
AggregateFunctionPtr create_aggregate_function_covariance_samp(const std::string& name,
36
                                                               const DataTypes& argument_types,
37
                                                               const DataTypePtr& result_type,
38
                                                               const bool result_is_nullable,
39
390
                                                               const AggregateFunctionAttr& attr) {
40
390
    return create_function_single_value<AggregateFunctionSampCovariance, SampData>(
41
390
            name, argument_types, result_is_nullable, attr);
42
390
}
43
44
AggregateFunctionPtr create_aggregate_function_covariance_pop(const std::string& name,
45
                                                              const DataTypes& argument_types,
46
                                                              const DataTypePtr& result_type,
47
                                                              const bool result_is_nullable,
48
387
                                                              const AggregateFunctionAttr& attr) {
49
387
    return create_function_single_value<AggregateFunctionSampCovariance, PopData>(
50
387
            name, argument_types, result_is_nullable, attr);
51
387
}
52
53
6
void register_aggregate_function_covar_pop(AggregateFunctionSimpleFactory& factory) {
54
6
    factory.register_function_both("covar", create_aggregate_function_covariance_pop);
55
6
    factory.register_alias("covar", "covar_pop");
56
6
}
57
58
6
void register_aggregate_function_covar_samp_old(AggregateFunctionSimpleFactory& factory) {
59
6
    BeExecVersionManager::registe_restrict_function_compatibility("covar_samp");
60
6
}
61
62
6
void register_aggregate_function_covar_samp(AggregateFunctionSimpleFactory& factory) {
63
6
    factory.register_function_both("covar_samp", create_aggregate_function_covariance_samp);
64
6
    register_aggregate_function_covar_samp_old(factory);
65
6
}
66
} // namespace doris