be/src/exprs/aggregate/aggregate_function_regr.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.h" |
19 | | |
20 | | #include "core/data_type/data_type.h" |
21 | | #include "core/data_type/define_primitive_type.h" |
22 | | #include "exprs/aggregate/aggregate_function.h" |
23 | | #include "exprs/aggregate/aggregate_function_simple_factory.h" |
24 | | #include "exprs/aggregate/factory_helpers.h" |
25 | | #include "exprs/aggregate/helpers.h" |
26 | | |
27 | | namespace doris { |
28 | | #include "common/compile_check_begin.h" |
29 | | |
30 | | template <RegrFunctionKind kind> |
31 | | AggregateFunctionPtr create_aggregate_function_regr(const std::string& name, |
32 | | const DataTypes& argument_types, |
33 | | const DataTypePtr& result_type, |
34 | | const bool result_is_nullable, |
35 | 269 | const AggregateFunctionAttr& attr) { |
36 | 269 | assert_arity_range(name, argument_types, 2, 2); |
37 | 269 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); |
38 | 269 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); |
39 | 269 | if constexpr (kind == RegrFunctionKind::regr_count) { |
40 | 23 | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); |
41 | 23 | DCHECK(!result_is_nullable); |
42 | 246 | } else { |
43 | 246 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); |
44 | 246 | DCHECK(result_is_nullable); |
45 | 246 | } |
46 | | |
47 | 269 | bool y_nullable_input = argument_types[0]->is_nullable(); |
48 | 269 | bool x_nullable_input = argument_types[1]->is_nullable(); |
49 | 269 | if (y_nullable_input) { |
50 | 178 | if (x_nullable_input) { |
51 | 114 | return creator_without_type::create_ignore_nullable< |
52 | 114 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, |
53 | 114 | result_is_nullable, attr); |
54 | 114 | } else { |
55 | 64 | return creator_without_type::create_ignore_nullable< |
56 | 64 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( |
57 | 64 | argument_types, result_is_nullable, attr); |
58 | 64 | } |
59 | 178 | } else { |
60 | 91 | if (x_nullable_input) { |
61 | 44 | return creator_without_type::create_ignore_nullable< |
62 | 44 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( |
63 | 44 | argument_types, result_is_nullable, attr); |
64 | 47 | } else { |
65 | 47 | return creator_without_type::create_ignore_nullable< |
66 | 47 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( |
67 | 47 | argument_types, result_is_nullable, attr); |
68 | 47 | } |
69 | 91 | } |
70 | 269 | } _ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE0EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 23 | const AggregateFunctionAttr& attr) { | 36 | 23 | assert_arity_range(name, argument_types, 2, 2); | 37 | 23 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 23 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 23 | } else { | 43 | 23 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 23 | DCHECK(result_is_nullable); | 45 | 23 | } | 46 | | | 47 | 23 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 23 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 23 | if (y_nullable_input) { | 50 | 15 | if (x_nullable_input) { | 51 | 11 | return creator_without_type::create_ignore_nullable< | 52 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 11 | result_is_nullable, attr); | 54 | 11 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 15 | } else { | 60 | 8 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 4 | return creator_without_type::create_ignore_nullable< | 66 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 4 | argument_types, result_is_nullable, attr); | 68 | 4 | } | 69 | 8 | } | 70 | 23 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE1EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 23 | const AggregateFunctionAttr& attr) { | 36 | 23 | assert_arity_range(name, argument_types, 2, 2); | 37 | 23 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 23 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 23 | } else { | 43 | 23 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 23 | DCHECK(result_is_nullable); | 45 | 23 | } | 46 | | | 47 | 23 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 23 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 23 | if (y_nullable_input) { | 50 | 15 | if (x_nullable_input) { | 51 | 11 | return creator_without_type::create_ignore_nullable< | 52 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 11 | result_is_nullable, attr); | 54 | 11 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 15 | } else { | 60 | 8 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 4 | return creator_without_type::create_ignore_nullable< | 66 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 4 | argument_types, result_is_nullable, attr); | 68 | 4 | } | 69 | 8 | } | 70 | 23 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE2EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 23 | const AggregateFunctionAttr& attr) { | 36 | 23 | assert_arity_range(name, argument_types, 2, 2); | 37 | 23 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 23 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | 23 | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | 23 | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | 23 | DCHECK(!result_is_nullable); | 42 | | } else { | 43 | | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | | DCHECK(result_is_nullable); | 45 | | } | 46 | | | 47 | 23 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 23 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 23 | if (y_nullable_input) { | 50 | 15 | if (x_nullable_input) { | 51 | 11 | return creator_without_type::create_ignore_nullable< | 52 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 11 | result_is_nullable, attr); | 54 | 11 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 15 | } else { | 60 | 8 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 4 | return creator_without_type::create_ignore_nullable< | 66 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 4 | argument_types, result_is_nullable, attr); | 68 | 4 | } | 69 | 8 | } | 70 | 23 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE3EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 63 | const AggregateFunctionAttr& attr) { | 36 | 63 | assert_arity_range(name, argument_types, 2, 2); | 37 | 63 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 63 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 63 | } else { | 43 | 63 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 63 | DCHECK(result_is_nullable); | 45 | 63 | } | 46 | | | 47 | 63 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 63 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 63 | if (y_nullable_input) { | 50 | 44 | if (x_nullable_input) { | 51 | 26 | return creator_without_type::create_ignore_nullable< | 52 | 26 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 26 | result_is_nullable, attr); | 54 | 26 | } else { | 55 | 18 | return creator_without_type::create_ignore_nullable< | 56 | 18 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 18 | argument_types, result_is_nullable, attr); | 58 | 18 | } | 59 | 44 | } else { | 60 | 19 | if (x_nullable_input) { | 61 | 8 | return creator_without_type::create_ignore_nullable< | 62 | 8 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 8 | argument_types, result_is_nullable, attr); | 64 | 11 | } else { | 65 | 11 | return creator_without_type::create_ignore_nullable< | 66 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 11 | argument_types, result_is_nullable, attr); | 68 | 11 | } | 69 | 19 | } | 70 | 63 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE4EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 63 | const AggregateFunctionAttr& attr) { | 36 | 63 | assert_arity_range(name, argument_types, 2, 2); | 37 | 63 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 63 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 63 | } else { | 43 | 63 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 63 | DCHECK(result_is_nullable); | 45 | 63 | } | 46 | | | 47 | 63 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 63 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 63 | if (y_nullable_input) { | 50 | 44 | if (x_nullable_input) { | 51 | 26 | return creator_without_type::create_ignore_nullable< | 52 | 26 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 26 | result_is_nullable, attr); | 54 | 26 | } else { | 55 | 18 | return creator_without_type::create_ignore_nullable< | 56 | 18 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 18 | argument_types, result_is_nullable, attr); | 58 | 18 | } | 59 | 44 | } else { | 60 | 19 | if (x_nullable_input) { | 61 | 8 | return creator_without_type::create_ignore_nullable< | 62 | 8 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 8 | argument_types, result_is_nullable, attr); | 64 | 11 | } else { | 65 | 11 | return creator_without_type::create_ignore_nullable< | 66 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 11 | argument_types, result_is_nullable, attr); | 68 | 11 | } | 69 | 19 | } | 70 | 63 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE5EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 17 | const AggregateFunctionAttr& attr) { | 36 | 17 | assert_arity_range(name, argument_types, 2, 2); | 37 | 17 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 17 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 17 | } else { | 43 | 17 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 17 | DCHECK(result_is_nullable); | 45 | 17 | } | 46 | | | 47 | 17 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 17 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 17 | if (y_nullable_input) { | 50 | 10 | if (x_nullable_input) { | 51 | 6 | return creator_without_type::create_ignore_nullable< | 52 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 6 | result_is_nullable, attr); | 54 | 6 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 10 | } else { | 60 | 7 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 3 | return creator_without_type::create_ignore_nullable< | 66 | 3 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 3 | argument_types, result_is_nullable, attr); | 68 | 3 | } | 69 | 7 | } | 70 | 17 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE6EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 17 | const AggregateFunctionAttr& attr) { | 36 | 17 | assert_arity_range(name, argument_types, 2, 2); | 37 | 17 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 17 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 17 | } else { | 43 | 17 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 17 | DCHECK(result_is_nullable); | 45 | 17 | } | 46 | | | 47 | 17 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 17 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 17 | if (y_nullable_input) { | 50 | 10 | if (x_nullable_input) { | 51 | 6 | return creator_without_type::create_ignore_nullable< | 52 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 6 | result_is_nullable, attr); | 54 | 6 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 10 | } else { | 60 | 7 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 3 | return creator_without_type::create_ignore_nullable< | 66 | 3 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 3 | argument_types, result_is_nullable, attr); | 68 | 3 | } | 69 | 7 | } | 70 | 17 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE7EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 17 | const AggregateFunctionAttr& attr) { | 36 | 17 | assert_arity_range(name, argument_types, 2, 2); | 37 | 17 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 17 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 17 | } else { | 43 | 17 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 17 | DCHECK(result_is_nullable); | 45 | 17 | } | 46 | | | 47 | 17 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 17 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 17 | if (y_nullable_input) { | 50 | 10 | if (x_nullable_input) { | 51 | 6 | return creator_without_type::create_ignore_nullable< | 52 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 6 | result_is_nullable, attr); | 54 | 6 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 10 | } else { | 60 | 7 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 3 | return creator_without_type::create_ignore_nullable< | 66 | 3 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 3 | argument_types, result_is_nullable, attr); | 68 | 3 | } | 69 | 7 | } | 70 | 17 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE8EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 35 | 23 | const AggregateFunctionAttr& attr) { | 36 | 23 | assert_arity_range(name, argument_types, 2, 2); | 37 | 23 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 38 | 23 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 39 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 40 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 41 | | DCHECK(!result_is_nullable); | 42 | 23 | } else { | 43 | 23 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 44 | 23 | DCHECK(result_is_nullable); | 45 | 23 | } | 46 | | | 47 | 23 | bool y_nullable_input = argument_types[0]->is_nullable(); | 48 | 23 | bool x_nullable_input = argument_types[1]->is_nullable(); | 49 | 23 | if (y_nullable_input) { | 50 | 15 | if (x_nullable_input) { | 51 | 11 | return creator_without_type::create_ignore_nullable< | 52 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 53 | 11 | result_is_nullable, attr); | 54 | 11 | } else { | 55 | 4 | return creator_without_type::create_ignore_nullable< | 56 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 57 | 4 | argument_types, result_is_nullable, attr); | 58 | 4 | } | 59 | 15 | } else { | 60 | 8 | if (x_nullable_input) { | 61 | 4 | return creator_without_type::create_ignore_nullable< | 62 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 63 | 4 | argument_types, result_is_nullable, attr); | 64 | 4 | } else { | 65 | 4 | return creator_without_type::create_ignore_nullable< | 66 | 4 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 67 | 4 | argument_types, result_is_nullable, attr); | 68 | 4 | } | 69 | 8 | } | 70 | 23 | } |
|
71 | | |
72 | 8 | void register_aggregate_function_regr(AggregateFunctionSimpleFactory& factory) { |
73 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_avgx>::name, |
74 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_avgx>); |
75 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_avgy>::name, |
76 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_avgy>); |
77 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_count>::name, |
78 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_count>); |
79 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_slope>::name, |
80 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_slope>); |
81 | 8 | factory.register_function_both( |
82 | 8 | RegrTraits<RegrFunctionKind::regr_intercept>::name, |
83 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_intercept>); |
84 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_sxx>::name, |
85 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_sxx>); |
86 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_syy>::name, |
87 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_syy>); |
88 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_sxy>::name, |
89 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_sxy>); |
90 | 8 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_r2>::name, |
91 | 8 | create_aggregate_function_regr<RegrFunctionKind::regr_r2>); |
92 | 8 | } |
93 | | |
94 | | } // namespace doris |