Coverage Report

Created: 2026-03-16 08:10

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
#include "common/compile_check_begin.h"
26
27
template <template <typename> class Function, template <PrimitiveType> class Data>
28
AggregateFunctionPtr create_function_single_value(const String& name,
29
                                                  const DataTypes& argument_types,
30
                                                  const bool result_is_nullable,
31
888
                                                  const AggregateFunctionAttr& attr) {
32
888
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
33
888
                                                                       result_is_nullable, attr);
34
888
}
_ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_8SampDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE
Line
Count
Source
31
445
                                                  const AggregateFunctionAttr& attr) {
32
445
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
33
445
                                                                       result_is_nullable, attr);
34
445
}
_ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_7PopDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE
Line
Count
Source
31
443
                                                  const AggregateFunctionAttr& attr) {
32
443
    return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types,
33
443
                                                                       result_is_nullable, attr);
34
443
}
35
36
AggregateFunctionPtr create_aggregate_function_covariance_samp(const std::string& name,
37
                                                               const DataTypes& argument_types,
38
                                                               const DataTypePtr& result_type,
39
                                                               const bool result_is_nullable,
40
446
                                                               const AggregateFunctionAttr& attr) {
41
446
    return create_function_single_value<AggregateFunctionSampCovariance, SampData>(
42
446
            name, argument_types, result_is_nullable, attr);
43
446
}
44
45
AggregateFunctionPtr create_aggregate_function_covariance_pop(const std::string& name,
46
                                                              const DataTypes& argument_types,
47
                                                              const DataTypePtr& result_type,
48
                                                              const bool result_is_nullable,
49
443
                                                              const AggregateFunctionAttr& attr) {
50
443
    return create_function_single_value<AggregateFunctionSampCovariance, PopData>(
51
443
            name, argument_types, result_is_nullable, attr);
52
443
}
53
54
6
void register_aggregate_function_covar_pop(AggregateFunctionSimpleFactory& factory) {
55
6
    factory.register_function_both("covar", create_aggregate_function_covariance_pop);
56
6
    factory.register_alias("covar", "covar_pop");
57
6
}
58
59
6
void register_aggregate_function_covar_samp_old(AggregateFunctionSimpleFactory& factory) {
60
6
    BeExecVersionManager::registe_restrict_function_compatibility("covar_samp");
61
6
}
62
63
6
void register_aggregate_function_covar_samp(AggregateFunctionSimpleFactory& factory) {
64
6
    factory.register_function_both("covar_samp", create_aggregate_function_covariance_samp);
65
6
    register_aggregate_function_covar_samp_old(factory);
66
6
}
67
} // namespace doris