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 | | |
29 | | template <RegrFunctionKind kind> |
30 | | AggregateFunctionPtr create_aggregate_function_regr(const std::string& name, |
31 | | const DataTypes& argument_types, |
32 | | const DataTypePtr& result_type, |
33 | | const bool result_is_nullable, |
34 | 314 | const AggregateFunctionAttr& attr) { |
35 | 314 | assert_arity_range(name, argument_types, 2, 2); |
36 | 314 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); |
37 | 314 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); |
38 | 314 | if constexpr (kind == RegrFunctionKind::regr_count) { |
39 | 28 | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); |
40 | 28 | DCHECK(!result_is_nullable); |
41 | 286 | } else { |
42 | 286 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); |
43 | 286 | DCHECK(result_is_nullable); |
44 | 286 | } |
45 | | |
46 | 314 | bool y_nullable_input = argument_types[0]->is_nullable(); |
47 | 314 | bool x_nullable_input = argument_types[1]->is_nullable(); |
48 | 314 | if (y_nullable_input) { |
49 | 187 | if (x_nullable_input) { |
50 | 114 | return creator_without_type::create_ignore_nullable< |
51 | 114 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, |
52 | 114 | result_is_nullable, attr); |
53 | 114 | } else { |
54 | 73 | return creator_without_type::create_ignore_nullable< |
55 | 73 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( |
56 | 73 | argument_types, result_is_nullable, attr); |
57 | 73 | } |
58 | 187 | } else { |
59 | 127 | if (x_nullable_input) { |
60 | 53 | return creator_without_type::create_ignore_nullable< |
61 | 53 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( |
62 | 53 | argument_types, result_is_nullable, attr); |
63 | 74 | } else { |
64 | 74 | return creator_without_type::create_ignore_nullable< |
65 | 74 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( |
66 | 74 | argument_types, result_is_nullable, attr); |
67 | 74 | } |
68 | 127 | } |
69 | 314 | } _ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE0EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 28 | const AggregateFunctionAttr& attr) { | 35 | 28 | assert_arity_range(name, argument_types, 2, 2); | 36 | 28 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 28 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 28 | } else { | 42 | 28 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 28 | DCHECK(result_is_nullable); | 44 | 28 | } | 45 | | | 46 | 28 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 28 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 28 | if (y_nullable_input) { | 49 | 16 | if (x_nullable_input) { | 50 | 11 | return creator_without_type::create_ignore_nullable< | 51 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 11 | result_is_nullable, attr); | 53 | 11 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 16 | } else { | 59 | 12 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 7 | } else { | 64 | 7 | return creator_without_type::create_ignore_nullable< | 65 | 7 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 7 | argument_types, result_is_nullable, attr); | 67 | 7 | } | 68 | 12 | } | 69 | 28 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE1EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 28 | const AggregateFunctionAttr& attr) { | 35 | 28 | assert_arity_range(name, argument_types, 2, 2); | 36 | 28 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 28 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 28 | } else { | 42 | 28 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 28 | DCHECK(result_is_nullable); | 44 | 28 | } | 45 | | | 46 | 28 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 28 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 28 | if (y_nullable_input) { | 49 | 16 | if (x_nullable_input) { | 50 | 11 | return creator_without_type::create_ignore_nullable< | 51 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 11 | result_is_nullable, attr); | 53 | 11 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 16 | } else { | 59 | 12 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 7 | } else { | 64 | 7 | return creator_without_type::create_ignore_nullable< | 65 | 7 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 7 | argument_types, result_is_nullable, attr); | 67 | 7 | } | 68 | 12 | } | 69 | 28 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE2EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 28 | const AggregateFunctionAttr& attr) { | 35 | 28 | assert_arity_range(name, argument_types, 2, 2); | 36 | 28 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 28 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | 28 | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | 28 | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | 28 | DCHECK(!result_is_nullable); | 41 | | } else { | 42 | | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | | DCHECK(result_is_nullable); | 44 | | } | 45 | | | 46 | 28 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 28 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 28 | if (y_nullable_input) { | 49 | 16 | if (x_nullable_input) { | 50 | 11 | return creator_without_type::create_ignore_nullable< | 51 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 11 | result_is_nullable, attr); | 53 | 11 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 16 | } else { | 59 | 12 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 7 | } else { | 64 | 7 | return creator_without_type::create_ignore_nullable< | 65 | 7 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 7 | argument_types, result_is_nullable, attr); | 67 | 7 | } | 68 | 12 | } | 69 | 28 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE3EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 68 | const AggregateFunctionAttr& attr) { | 35 | 68 | assert_arity_range(name, argument_types, 2, 2); | 36 | 68 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 68 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 68 | } else { | 42 | 68 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 68 | DCHECK(result_is_nullable); | 44 | 68 | } | 45 | | | 46 | 68 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 68 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 68 | if (y_nullable_input) { | 49 | 45 | if (x_nullable_input) { | 50 | 26 | return creator_without_type::create_ignore_nullable< | 51 | 26 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 26 | result_is_nullable, attr); | 53 | 26 | } else { | 54 | 19 | return creator_without_type::create_ignore_nullable< | 55 | 19 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 19 | argument_types, result_is_nullable, attr); | 57 | 19 | } | 58 | 45 | } else { | 59 | 23 | if (x_nullable_input) { | 60 | 9 | return creator_without_type::create_ignore_nullable< | 61 | 9 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 9 | argument_types, result_is_nullable, attr); | 63 | 14 | } else { | 64 | 14 | return creator_without_type::create_ignore_nullable< | 65 | 14 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 14 | argument_types, result_is_nullable, attr); | 67 | 14 | } | 68 | 23 | } | 69 | 68 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE4EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 68 | const AggregateFunctionAttr& attr) { | 35 | 68 | assert_arity_range(name, argument_types, 2, 2); | 36 | 68 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 68 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 68 | } else { | 42 | 68 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 68 | DCHECK(result_is_nullable); | 44 | 68 | } | 45 | | | 46 | 68 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 68 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 68 | if (y_nullable_input) { | 49 | 45 | if (x_nullable_input) { | 50 | 26 | return creator_without_type::create_ignore_nullable< | 51 | 26 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 26 | result_is_nullable, attr); | 53 | 26 | } else { | 54 | 19 | return creator_without_type::create_ignore_nullable< | 55 | 19 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 19 | argument_types, result_is_nullable, attr); | 57 | 19 | } | 58 | 45 | } else { | 59 | 23 | if (x_nullable_input) { | 60 | 9 | return creator_without_type::create_ignore_nullable< | 61 | 9 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 9 | argument_types, result_is_nullable, attr); | 63 | 14 | } else { | 64 | 14 | return creator_without_type::create_ignore_nullable< | 65 | 14 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 14 | argument_types, result_is_nullable, attr); | 67 | 14 | } | 68 | 23 | } | 69 | 68 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE5EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 22 | const AggregateFunctionAttr& attr) { | 35 | 22 | assert_arity_range(name, argument_types, 2, 2); | 36 | 22 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 22 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 22 | } else { | 42 | 22 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 22 | DCHECK(result_is_nullable); | 44 | 22 | } | 45 | | | 46 | 22 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 22 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 22 | if (y_nullable_input) { | 49 | 11 | if (x_nullable_input) { | 50 | 6 | return creator_without_type::create_ignore_nullable< | 51 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 6 | result_is_nullable, attr); | 53 | 6 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 11 | } else { | 59 | 11 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 6 | } else { | 64 | 6 | return creator_without_type::create_ignore_nullable< | 65 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 6 | argument_types, result_is_nullable, attr); | 67 | 6 | } | 68 | 11 | } | 69 | 22 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE6EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 22 | const AggregateFunctionAttr& attr) { | 35 | 22 | assert_arity_range(name, argument_types, 2, 2); | 36 | 22 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 22 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 22 | } else { | 42 | 22 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 22 | DCHECK(result_is_nullable); | 44 | 22 | } | 45 | | | 46 | 22 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 22 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 22 | if (y_nullable_input) { | 49 | 11 | if (x_nullable_input) { | 50 | 6 | return creator_without_type::create_ignore_nullable< | 51 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 6 | result_is_nullable, attr); | 53 | 6 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 11 | } else { | 59 | 11 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 6 | } else { | 64 | 6 | return creator_without_type::create_ignore_nullable< | 65 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 6 | argument_types, result_is_nullable, attr); | 67 | 6 | } | 68 | 11 | } | 69 | 22 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE7EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 22 | const AggregateFunctionAttr& attr) { | 35 | 22 | assert_arity_range(name, argument_types, 2, 2); | 36 | 22 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 22 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 22 | } else { | 42 | 22 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 22 | DCHECK(result_is_nullable); | 44 | 22 | } | 45 | | | 46 | 22 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 22 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 22 | if (y_nullable_input) { | 49 | 11 | if (x_nullable_input) { | 50 | 6 | return creator_without_type::create_ignore_nullable< | 51 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 6 | result_is_nullable, attr); | 53 | 6 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 11 | } else { | 59 | 11 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 6 | } else { | 64 | 6 | return creator_without_type::create_ignore_nullable< | 65 | 6 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 6 | argument_types, result_is_nullable, attr); | 67 | 6 | } | 68 | 11 | } | 69 | 22 | } |
_ZN5doris30create_aggregate_function_regrILNS_16RegrFunctionKindE8EEESt10shared_ptrINS_18IAggregateFunctionEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS2_IKNS_9IDataTypeEESaISG_EERKSG_bRKNS_21AggregateFunctionAttrE Line | Count | Source | 34 | 28 | const AggregateFunctionAttr& attr) { | 35 | 28 | assert_arity_range(name, argument_types, 2, 2); | 36 | 28 | DCHECK(argument_types[0]->get_primitive_type() == TYPE_DOUBLE); | 37 | 28 | DCHECK(argument_types[1]->get_primitive_type() == TYPE_DOUBLE); | 38 | | if constexpr (kind == RegrFunctionKind::regr_count) { | 39 | | DCHECK(result_type->get_primitive_type() == TYPE_BIGINT); | 40 | | DCHECK(!result_is_nullable); | 41 | 28 | } else { | 42 | 28 | DCHECK(result_type->get_primitive_type() == TYPE_DOUBLE); | 43 | 28 | DCHECK(result_is_nullable); | 44 | 28 | } | 45 | | | 46 | 28 | bool y_nullable_input = argument_types[0]->is_nullable(); | 47 | 28 | bool x_nullable_input = argument_types[1]->is_nullable(); | 48 | 28 | if (y_nullable_input) { | 49 | 16 | if (x_nullable_input) { | 50 | 11 | return creator_without_type::create_ignore_nullable< | 51 | 11 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, true>>(argument_types, | 52 | 11 | result_is_nullable, attr); | 53 | 11 | } else { | 54 | 5 | return creator_without_type::create_ignore_nullable< | 55 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, true, false>>( | 56 | 5 | argument_types, result_is_nullable, attr); | 57 | 5 | } | 58 | 16 | } else { | 59 | 12 | if (x_nullable_input) { | 60 | 5 | return creator_without_type::create_ignore_nullable< | 61 | 5 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, true>>( | 62 | 5 | argument_types, result_is_nullable, attr); | 63 | 7 | } else { | 64 | 7 | return creator_without_type::create_ignore_nullable< | 65 | 7 | AggregateFunctionRegr<TYPE_DOUBLE, kind, false, false>>( | 66 | 7 | argument_types, result_is_nullable, attr); | 67 | 7 | } | 68 | 12 | } | 69 | 28 | } |
|
70 | | |
71 | 6 | void register_aggregate_function_regr(AggregateFunctionSimpleFactory& factory) { |
72 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_avgx>::name, |
73 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_avgx>); |
74 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_avgy>::name, |
75 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_avgy>); |
76 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_count>::name, |
77 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_count>); |
78 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_slope>::name, |
79 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_slope>); |
80 | 6 | factory.register_function_both( |
81 | 6 | RegrTraits<RegrFunctionKind::regr_intercept>::name, |
82 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_intercept>); |
83 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_sxx>::name, |
84 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_sxx>); |
85 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_syy>::name, |
86 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_syy>); |
87 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_sxy>::name, |
88 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_sxy>); |
89 | 6 | factory.register_function_both(RegrTraits<RegrFunctionKind::regr_r2>::name, |
90 | 6 | create_aggregate_function_regr<RegrFunctionKind::regr_r2>); |
91 | 6 | } |
92 | | |
93 | | } // namespace doris |