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 | 665 | const AggregateFunctionAttr& attr) { |
32 | 665 | return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types, |
33 | 665 | result_is_nullable, attr); |
34 | 665 | } _ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_8SampDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE Line | Count | Source | 31 | 335 | const AggregateFunctionAttr& attr) { | 32 | 335 | return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types, | 33 | 335 | result_is_nullable, attr); | 34 | 335 | } |
_ZN5doris28create_function_single_valueINS_31AggregateFunctionSampCovarianceENS_7PopDataEEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS3_IKNS_9IDataTypeEESaISH_EEbRKNS_21AggregateFunctionAttrE Line | Count | Source | 31 | 330 | const AggregateFunctionAttr& attr) { | 32 | 330 | return creator_with_type_list<TYPE_DOUBLE>::create<Function, Data>(argument_types, | 33 | 330 | result_is_nullable, attr); | 34 | 330 | } |
|
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 | 335 | const AggregateFunctionAttr& attr) { |
41 | 335 | return create_function_single_value<AggregateFunctionSampCovariance, SampData>( |
42 | 335 | name, argument_types, result_is_nullable, attr); |
43 | 335 | } |
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 | 331 | const AggregateFunctionAttr& attr) { |
50 | 331 | return create_function_single_value<AggregateFunctionSampCovariance, PopData>( |
51 | 331 | name, argument_types, result_is_nullable, attr); |
52 | 331 | } |
53 | | |
54 | 8 | void register_aggregate_function_covar_pop(AggregateFunctionSimpleFactory& factory) { |
55 | 8 | factory.register_function_both("covar", create_aggregate_function_covariance_pop); |
56 | 8 | factory.register_alias("covar", "covar_pop"); |
57 | 8 | } |
58 | | |
59 | 8 | void register_aggregate_function_covar_samp_old(AggregateFunctionSimpleFactory& factory) { |
60 | 8 | BeExecVersionManager::registe_restrict_function_compatibility("covar_samp"); |
61 | 8 | } |
62 | | |
63 | 8 | void register_aggregate_function_covar_samp(AggregateFunctionSimpleFactory& factory) { |
64 | 8 | factory.register_function_both("covar_samp", create_aggregate_function_covariance_samp); |
65 | 8 | register_aggregate_function_covar_samp_old(factory); |
66 | 8 | } |
67 | | } // namespace doris |