/root/doris/be/src/vec/functions/math.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 <cstdint> |
19 | | #include <cstring> |
20 | | |
21 | | // IWYU pragma: no_include <bits/std_abs.h> |
22 | | #include <dlfcn.h> |
23 | | |
24 | | #include <cmath> |
25 | | #include <string> |
26 | | #include <type_traits> |
27 | | |
28 | | #include "common/status.h" |
29 | | #include "vec/columns/column.h" |
30 | | #include "vec/columns/column_string.h" |
31 | | #include "vec/columns/column_vector.h" |
32 | | #include "vec/core/types.h" |
33 | | #include "vec/data_types/data_type_string.h" |
34 | | #include "vec/data_types/number_traits.h" |
35 | | #include "vec/functions/function_const.h" |
36 | | #include "vec/functions/function_math_log.h" |
37 | | #include "vec/functions/function_math_unary.h" |
38 | | #include "vec/functions/function_math_unary_alway_nullable.h" |
39 | | #include "vec/functions/function_totype.h" |
40 | | #include "vec/functions/function_unary_arithmetic.h" |
41 | | #include "vec/functions/simple_function_factory.h" |
42 | | #include "vec/utils/stringop_substring.h" |
43 | | |
44 | | namespace doris::vectorized { |
45 | | |
46 | | struct AcosName { |
47 | | static constexpr auto name = "acos"; |
48 | | // https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_acos |
49 | 4 | static constexpr bool is_invalid_input(Float64 x) { return x < -1 || x > 1; } |
50 | | }; |
51 | | using FunctionAcos = |
52 | | FunctionMathUnaryAlwayNullable<UnaryFunctionPlainAlwayNullable<AcosName, std::acos>>; |
53 | | |
54 | | struct AcoshName { |
55 | | static constexpr auto name = "acosh"; |
56 | 10 | static constexpr bool is_invalid_input(Float64 x) { return x < 1; } |
57 | | }; |
58 | | using FunctionAcosh = |
59 | | FunctionMathUnaryAlwayNullable<UnaryFunctionPlainAlwayNullable<AcoshName, std::acosh>>; |
60 | | |
61 | | struct AsinName { |
62 | | static constexpr auto name = "asin"; |
63 | | // https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_asin |
64 | 4 | static constexpr bool is_invalid_input(Float64 x) { return x < -1 || x > 1; } |
65 | | }; |
66 | | using FunctionAsin = |
67 | | FunctionMathUnaryAlwayNullable<UnaryFunctionPlainAlwayNullable<AsinName, std::asin>>; |
68 | | |
69 | | struct AsinhName { |
70 | | static constexpr auto name = "asinh"; |
71 | | }; |
72 | | using FunctionAsinh = FunctionMathUnary<UnaryFunctionPlain<AsinhName, std::asinh>>; |
73 | | |
74 | | class FunctionAtan : public IFunction { |
75 | | public: |
76 | | static constexpr auto name = "atan"; |
77 | 3 | static FunctionPtr create() { return std::make_shared<FunctionAtan>(); } |
78 | | |
79 | 0 | String get_name() const override { return name; } |
80 | 2 | bool is_variadic() const override { return true; } |
81 | 0 | size_t get_number_of_arguments() const override { return 0; } |
82 | | |
83 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
84 | 1 | return std::make_shared<DataTypeFloat64>(); |
85 | 1 | } |
86 | | |
87 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
88 | 1 | uint32_t result, size_t input_rows_count) const override { |
89 | 1 | if (arguments.size() == 1) { |
90 | 1 | return execute_unary(block, arguments, result, input_rows_count); |
91 | 1 | } else if (arguments.size() == 2) { |
92 | 0 | return execute_binary(block, arguments, result, input_rows_count); |
93 | 0 | } else { |
94 | 0 | return Status::InvalidArgument("atan function expects 1 or 2 arguments, but got {}", |
95 | 0 | arguments.size()); |
96 | 0 | } |
97 | 1 | } |
98 | | |
99 | | private: |
100 | | Status execute_unary(Block& block, const ColumnNumbers& arguments, uint32_t result, |
101 | 1 | size_t input_rows_count) const { |
102 | 1 | auto res_col = ColumnFloat64::create(input_rows_count); |
103 | 1 | auto& res_data = res_col->get_data(); |
104 | | |
105 | 1 | const auto& col_data = |
106 | 1 | assert_cast<const ColumnFloat64*>(block.get_by_position(arguments[0]).column.get()) |
107 | 1 | ->get_data(); |
108 | 5 | for (size_t i = 0; i < input_rows_count; ++i) { |
109 | 4 | res_data[i] = std::atan(col_data[i]); |
110 | 4 | } |
111 | | |
112 | 1 | block.replace_by_position(result, std::move(res_col)); |
113 | 1 | return Status::OK(); |
114 | 1 | } |
115 | | |
116 | | Status execute_binary(Block& block, const ColumnNumbers& arguments, uint32_t result, |
117 | 0 | size_t input_rows_count) const { |
118 | 0 | auto [col_y, is_const_y] = unpack_if_const(block.get_by_position(arguments[0]).column); |
119 | 0 | auto [col_x, is_const_x] = unpack_if_const(block.get_by_position(arguments[1]).column); |
120 | |
|
121 | 0 | auto result_column = ColumnFloat64::create(input_rows_count); |
122 | 0 | auto& result_data = result_column->get_data(); |
123 | |
|
124 | 0 | if (is_const_y) { |
125 | 0 | auto y_val = assert_cast<const ColumnFloat64*>(col_y.get())->get_element(0); |
126 | |
|
127 | 0 | const auto* x_col = assert_cast<const ColumnFloat64*>(col_x.get()); |
128 | 0 | const auto& x_data = x_col->get_data(); |
129 | 0 | for (size_t i = 0; i < input_rows_count; ++i) { |
130 | 0 | result_data[i] = std::atan2(y_val, x_data[i]); |
131 | 0 | } |
132 | 0 | } else if (is_const_x) { |
133 | 0 | auto x_val = assert_cast<const ColumnFloat64*>(col_x.get())->get_element(0); |
134 | |
|
135 | 0 | const auto* y_col = assert_cast<const ColumnFloat64*>(col_y.get()); |
136 | 0 | const auto& y_data = y_col->get_data(); |
137 | 0 | for (size_t i = 0; i < input_rows_count; ++i) { |
138 | 0 | result_data[i] = std::atan2(y_data[i], x_val); |
139 | 0 | } |
140 | 0 | } else { |
141 | 0 | const auto* y_col = assert_cast<const ColumnFloat64*>(col_y.get()); |
142 | 0 | const auto* x_col = assert_cast<const ColumnFloat64*>(col_x.get()); |
143 | 0 | const auto& y_data = y_col->get_data(); |
144 | 0 | const auto& x_data = x_col->get_data(); |
145 | 0 | for (size_t i = 0; i < input_rows_count; ++i) { |
146 | 0 | result_data[i] = std::atan2(y_data[i], x_data[i]); |
147 | 0 | } |
148 | 0 | } |
149 | |
|
150 | 0 | block.replace_by_position(result, std::move(result_column)); |
151 | 0 | return Status::OK(); |
152 | 0 | } |
153 | | }; |
154 | | |
155 | | struct AtanhName { |
156 | | static constexpr auto name = "atanh"; |
157 | 10 | static constexpr bool is_invalid_input(Float64 x) { return x <= -1 || x >= 1; } |
158 | | }; |
159 | | using FunctionAtanh = |
160 | | FunctionMathUnaryAlwayNullable<UnaryFunctionPlainAlwayNullable<AtanhName, std::atanh>>; |
161 | | |
162 | | struct CosName { |
163 | | static constexpr auto name = "cos"; |
164 | | }; |
165 | | using FunctionCos = FunctionMathUnary<UnaryFunctionPlain<CosName, std::cos>>; |
166 | | |
167 | | struct CoshName { |
168 | | static constexpr auto name = "cosh"; |
169 | | }; |
170 | | using FunctionCosh = FunctionMathUnary<UnaryFunctionPlain<CoshName, std::cosh>>; |
171 | | |
172 | | struct EImpl { |
173 | | static constexpr auto name = "e"; |
174 | | static constexpr double value = 2.7182818284590452353602874713526624977572470; |
175 | | }; |
176 | | using FunctionE = FunctionMathConstFloat64<EImpl>; |
177 | | |
178 | | struct PiImpl { |
179 | | static constexpr auto name = "pi"; |
180 | | static constexpr double value = 3.1415926535897932384626433832795028841971693; |
181 | | }; |
182 | | using FunctionPi = FunctionMathConstFloat64<PiImpl>; |
183 | | |
184 | | struct ExpName { |
185 | | static constexpr auto name = "exp"; |
186 | | }; |
187 | | using FunctionExp = FunctionMathUnary<UnaryFunctionPlain<ExpName, std::exp>>; |
188 | | |
189 | | template <typename A> |
190 | | struct SignImpl { |
191 | | static constexpr PrimitiveType ResultType = TYPE_TINYINT; |
192 | 6 | static inline UInt8 apply(A a) { |
193 | 6 | if constexpr (IsDecimalNumber<A> || std::is_floating_point_v<A>) { |
194 | 3 | return static_cast<UInt8>(a < A(0) ? -1 : a == A(0) ? 0 : 1); |
195 | 3 | } else if constexpr (IsSignedV<A>) { |
196 | 3 | return static_cast<UInt8>(a < 0 ? -1 : a == 0 ? 0 : 1); |
197 | | } else { |
198 | | static_assert(std::is_same_v<A, void>, "Unsupported type in SignImpl"); |
199 | | } |
200 | 6 | } Unexecuted instantiation: _ZN5doris10vectorized8SignImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized8SignImplIsE5applyEs _ZN5doris10vectorized8SignImplIiE5applyEi Line | Count | Source | 192 | 3 | static inline UInt8 apply(A a) { | 193 | | if constexpr (IsDecimalNumber<A> || std::is_floating_point_v<A>) { | 194 | | return static_cast<UInt8>(a < A(0) ? -1 : a == A(0) ? 0 : 1); | 195 | 3 | } else if constexpr (IsSignedV<A>) { | 196 | 3 | return static_cast<UInt8>(a < 0 ? -1 : a == 0 ? 0 : 1); | 197 | | } else { | 198 | | static_assert(std::is_same_v<A, void>, "Unsupported type in SignImpl"); | 199 | | } | 200 | 3 | } |
Unexecuted instantiation: _ZN5doris10vectorized8SignImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized8SignImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized8SignImplIfE5applyEf _ZN5doris10vectorized8SignImplIdE5applyEd Line | Count | Source | 192 | 3 | static inline UInt8 apply(A a) { | 193 | 3 | if constexpr (IsDecimalNumber<A> || std::is_floating_point_v<A>) { | 194 | 3 | return static_cast<UInt8>(a < A(0) ? -1 : a == A(0) ? 0 : 1); | 195 | | } else if constexpr (IsSignedV<A>) { | 196 | | return static_cast<UInt8>(a < 0 ? -1 : a == 0 ? 0 : 1); | 197 | | } else { | 198 | | static_assert(std::is_same_v<A, void>, "Unsupported type in SignImpl"); | 199 | | } | 200 | 3 | } |
|
201 | | }; |
202 | | |
203 | | struct NameSign { |
204 | | static constexpr auto name = "sign"; |
205 | | }; |
206 | | using FunctionSign = FunctionUnaryArithmetic<SignImpl, NameSign>; |
207 | | |
208 | | template <typename A> |
209 | | struct AbsImpl { |
210 | | static constexpr PrimitiveType ResultType = NumberTraits::ResultOfAbs<A>::Type; |
211 | | |
212 | 12 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
213 | 12 | if constexpr (IsDecimalNumber<A>) { |
214 | 0 | return a < A(0) ? A(-a) : a; |
215 | 7 | } else if constexpr (IsIntegralV<A>) { |
216 | 7 | return a < A(0) ? static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( |
217 | 3 | ~a) + |
218 | 3 | 1 |
219 | 7 | : a; |
220 | 7 | } else if constexpr (std::is_floating_point_v<A>) { |
221 | 5 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( |
222 | 5 | std::abs(a)); |
223 | | } else { |
224 | | static_assert(std::is_same_v<A, void>, "Unsupported type in AbsImpl"); |
225 | | } |
226 | 12 | } Unexecuted instantiation: _ZN5doris10vectorized7AbsImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized7AbsImplIsE5applyEs _ZN5doris10vectorized7AbsImplIiE5applyEi Line | Count | Source | 212 | 7 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 213 | | if constexpr (IsDecimalNumber<A>) { | 214 | | return a < A(0) ? A(-a) : a; | 215 | 7 | } else if constexpr (IsIntegralV<A>) { | 216 | 7 | return a < A(0) ? static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( | 217 | 3 | ~a) + | 218 | 3 | 1 | 219 | 7 | : a; | 220 | | } else if constexpr (std::is_floating_point_v<A>) { | 221 | | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( | 222 | | std::abs(a)); | 223 | | } else { | 224 | | static_assert(std::is_same_v<A, void>, "Unsupported type in AbsImpl"); | 225 | | } | 226 | 7 | } |
Unexecuted instantiation: _ZN5doris10vectorized7AbsImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized7AbsImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized7AbsImplIfE5applyEf _ZN5doris10vectorized7AbsImplIdE5applyEd Line | Count | Source | 212 | 5 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 213 | | if constexpr (IsDecimalNumber<A>) { | 214 | | return a < A(0) ? A(-a) : a; | 215 | | } else if constexpr (IsIntegralV<A>) { | 216 | | return a < A(0) ? static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( | 217 | | ~a) + | 218 | | 1 | 219 | | : a; | 220 | 5 | } else if constexpr (std::is_floating_point_v<A>) { | 221 | 5 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>( | 222 | 5 | std::abs(a)); | 223 | | } else { | 224 | | static_assert(std::is_same_v<A, void>, "Unsupported type in AbsImpl"); | 225 | | } | 226 | 5 | } |
Unexecuted instantiation: _ZN5doris10vectorized7AbsImplINS0_7DecimalIiEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized7AbsImplINS0_7DecimalIlEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized7AbsImplINS0_7DecimalInEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized7AbsImplINS0_12Decimal128V3EE5applyES2_ Unexecuted instantiation: _ZN5doris10vectorized7AbsImplINS0_7DecimalIN4wide7integerILm256EiEEEEE5applyES6_ |
227 | | }; |
228 | | |
229 | | struct NameAbs { |
230 | | static constexpr auto name = "abs"; |
231 | | }; |
232 | | |
233 | | template <typename A> |
234 | | struct ResultOfUnaryFunc; |
235 | | |
236 | | template <> |
237 | | struct ResultOfUnaryFunc<UInt8> { |
238 | | static constexpr PrimitiveType ResultType = TYPE_BOOLEAN; |
239 | | }; |
240 | | |
241 | | template <> |
242 | | struct ResultOfUnaryFunc<Int8> { |
243 | | static constexpr PrimitiveType ResultType = TYPE_TINYINT; |
244 | | }; |
245 | | |
246 | | template <> |
247 | | struct ResultOfUnaryFunc<Int16> { |
248 | | static constexpr PrimitiveType ResultType = TYPE_SMALLINT; |
249 | | }; |
250 | | |
251 | | template <> |
252 | | struct ResultOfUnaryFunc<Int32> { |
253 | | static constexpr PrimitiveType ResultType = TYPE_INT; |
254 | | }; |
255 | | |
256 | | template <> |
257 | | struct ResultOfUnaryFunc<Int64> { |
258 | | static constexpr PrimitiveType ResultType = TYPE_BIGINT; |
259 | | }; |
260 | | |
261 | | template <> |
262 | | struct ResultOfUnaryFunc<Int128> { |
263 | | static constexpr PrimitiveType ResultType = TYPE_LARGEINT; |
264 | | }; |
265 | | |
266 | | template <> |
267 | | struct ResultOfUnaryFunc<Decimal32> { |
268 | | static constexpr PrimitiveType ResultType = TYPE_DECIMAL32; |
269 | | }; |
270 | | |
271 | | template <> |
272 | | struct ResultOfUnaryFunc<Decimal64> { |
273 | | static constexpr PrimitiveType ResultType = TYPE_DECIMAL64; |
274 | | }; |
275 | | |
276 | | template <> |
277 | | struct ResultOfUnaryFunc<Decimal128V3> { |
278 | | static constexpr PrimitiveType ResultType = TYPE_DECIMAL128I; |
279 | | }; |
280 | | |
281 | | template <> |
282 | | struct ResultOfUnaryFunc<Decimal128V2> { |
283 | | static constexpr PrimitiveType ResultType = TYPE_DECIMALV2; |
284 | | }; |
285 | | |
286 | | template <> |
287 | | struct ResultOfUnaryFunc<Decimal256> { |
288 | | static constexpr PrimitiveType ResultType = TYPE_DECIMAL256; |
289 | | }; |
290 | | |
291 | | template <> |
292 | | struct ResultOfUnaryFunc<float> { |
293 | | static constexpr PrimitiveType ResultType = TYPE_FLOAT; |
294 | | }; |
295 | | |
296 | | template <> |
297 | | struct ResultOfUnaryFunc<double> { |
298 | | static constexpr PrimitiveType ResultType = TYPE_DOUBLE; |
299 | | }; |
300 | | |
301 | | using FunctionAbs = FunctionUnaryArithmetic<AbsImpl, NameAbs>; |
302 | | |
303 | | template <typename A> |
304 | | struct NegativeImpl { |
305 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
306 | | |
307 | | NO_SANITIZE_UNDEFINED static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType |
308 | 8 | apply(A a) { |
309 | 8 | return -a; |
310 | 8 | } Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplIsE5applyEs _ZN5doris10vectorized12NegativeImplIiE5applyEi Line | Count | Source | 308 | 4 | apply(A a) { | 309 | 4 | return -a; | 310 | 4 | } |
Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplIfE5applyEf _ZN5doris10vectorized12NegativeImplIdE5applyEd Line | Count | Source | 308 | 4 | apply(A a) { | 309 | 4 | return -a; | 310 | 4 | } |
Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplINS0_7DecimalIiEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplINS0_7DecimalIlEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplINS0_7DecimalInEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplINS0_12Decimal128V3EE5applyES2_ Unexecuted instantiation: _ZN5doris10vectorized12NegativeImplINS0_7DecimalIN4wide7integerILm256EiEEEEE5applyES6_ |
311 | | }; |
312 | | |
313 | | struct NameNegative { |
314 | | static constexpr auto name = "negative"; |
315 | | }; |
316 | | |
317 | | using FunctionNegative = FunctionUnaryArithmetic<NegativeImpl, NameNegative>; |
318 | | |
319 | | template <typename A> |
320 | | struct PositiveImpl { |
321 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
322 | | |
323 | 12 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
324 | 12 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a); |
325 | 12 | } Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplIsE5applyEs _ZN5doris10vectorized12PositiveImplIiE5applyEi Line | Count | Source | 323 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 324 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a); | 325 | 4 | } |
Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplIfE5applyEf _ZN5doris10vectorized12PositiveImplIdE5applyEd Line | Count | Source | 323 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 324 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a); | 325 | 4 | } |
Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplINS0_7DecimalIiEEE5applyES3_ _ZN5doris10vectorized12PositiveImplINS0_7DecimalIlEEE5applyES3_ Line | Count | Source | 323 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 324 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a); | 325 | 4 | } |
Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplINS0_7DecimalInEEE5applyES3_ Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplINS0_12Decimal128V3EE5applyES2_ Unexecuted instantiation: _ZN5doris10vectorized12PositiveImplINS0_7DecimalIN4wide7integerILm256EiEEEEE5applyES6_ |
326 | | }; |
327 | | |
328 | | struct NamePositive { |
329 | | static constexpr auto name = "positive"; |
330 | | }; |
331 | | |
332 | | using FunctionPositive = FunctionUnaryArithmetic<PositiveImpl, NamePositive>; |
333 | | |
334 | | struct SinName { |
335 | | static constexpr auto name = "sin"; |
336 | | }; |
337 | | using FunctionSin = FunctionMathUnary<UnaryFunctionPlain<SinName, std::sin>>; |
338 | | |
339 | | struct SinhName { |
340 | | static constexpr auto name = "sinh"; |
341 | | }; |
342 | | using FunctionSinh = FunctionMathUnary<UnaryFunctionPlain<SinhName, std::sinh>>; |
343 | | |
344 | | struct SqrtName { |
345 | | static constexpr auto name = "sqrt"; |
346 | | // https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_sqrt |
347 | 4 | static constexpr bool is_invalid_input(Float64 x) { return x < 0; } |
348 | | }; |
349 | | using FunctionSqrt = |
350 | | FunctionMathUnaryAlwayNullable<UnaryFunctionPlainAlwayNullable<SqrtName, std::sqrt>>; |
351 | | |
352 | | struct CbrtName { |
353 | | static constexpr auto name = "cbrt"; |
354 | | }; |
355 | | using FunctionCbrt = FunctionMathUnary<UnaryFunctionPlain<CbrtName, std::cbrt>>; |
356 | | |
357 | | struct TanName { |
358 | | static constexpr auto name = "tan"; |
359 | | }; |
360 | | using FunctionTan = FunctionMathUnary<UnaryFunctionPlain<TanName, std::tan>>; |
361 | | |
362 | | struct TanhName { |
363 | | static constexpr auto name = "tanh"; |
364 | | }; |
365 | | using FunctionTanh = FunctionMathUnary<UnaryFunctionPlain<TanhName, std::tanh>>; |
366 | | |
367 | | struct CotName { |
368 | | static constexpr auto name = "cot"; |
369 | | }; |
370 | 2 | double cot(double x) { |
371 | 2 | return 1.0 / std::tan(x); |
372 | 2 | } |
373 | | using FunctionCot = FunctionMathUnary<UnaryFunctionPlain<CotName, cot>>; |
374 | | |
375 | | struct SecName { |
376 | | static constexpr auto name = "sec"; |
377 | | }; |
378 | 2 | double sec(double x) { |
379 | 2 | return 1.0 / std::cos(x); |
380 | 2 | } |
381 | | using FunctionSec = FunctionMathUnary<UnaryFunctionPlain<SecName, sec>>; |
382 | | |
383 | | struct CscName { |
384 | | static constexpr auto name = "csc"; |
385 | | }; |
386 | 3 | double csc(double x) { |
387 | 3 | return 1.0 / std::sin(x); |
388 | 3 | } |
389 | | using FunctionCosec = FunctionMathUnary<UnaryFunctionPlain<CscName, csc>>; |
390 | | |
391 | | static const Int64 FACT_TABLE[] = {1LL, |
392 | | 1LL, |
393 | | 2LL, |
394 | | 6LL, |
395 | | 24LL, |
396 | | 120LL, |
397 | | 720LL, |
398 | | 5040LL, |
399 | | 40320LL, |
400 | | 362880LL, |
401 | | 3628800LL, |
402 | | 39916800LL, |
403 | | 479001600LL, |
404 | | 6227020800LL, |
405 | | 87178291200LL, |
406 | | 1307674368000LL, |
407 | | 20922789888000LL, |
408 | | 355687428096000LL, |
409 | | 6402373705728000LL, |
410 | | 121645100408832000LL, |
411 | | 2432902008176640000LL}; |
412 | | |
413 | | class FunctionFactorial : public IFunction { |
414 | | public: |
415 | | static constexpr auto name = "factorial"; |
416 | 16 | static FunctionPtr create() { return std::make_shared<FunctionFactorial>(); } |
417 | | |
418 | | private: |
419 | 1 | String get_name() const override { return name; } |
420 | 14 | size_t get_number_of_arguments() const override { return 1; } |
421 | | |
422 | 14 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
423 | 14 | return make_nullable(std::make_shared<DataTypeInt64>()); |
424 | 14 | } |
425 | | |
426 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
427 | 12 | uint32_t result, size_t input_rows_count) const override { |
428 | 12 | const auto* data_col = |
429 | 12 | check_and_get_column<ColumnInt64>(block.get_by_position(arguments[0]).column.get()); |
430 | 12 | if (!data_col) { |
431 | 0 | return Status::InternalError( |
432 | 0 | "Unexpected column '%s' for argument of function %s", |
433 | 0 | block.get_by_position(arguments[0]).column->get_name().c_str(), get_name()); |
434 | 0 | } |
435 | | |
436 | 12 | auto result_column = ColumnInt64::create(input_rows_count); |
437 | 12 | auto result_null_map = ColumnUInt8::create(input_rows_count, 0); |
438 | 12 | auto& result_data = result_column->get_data(); |
439 | 12 | auto& result_null_map_data = result_null_map->get_data(); |
440 | | |
441 | 12 | const auto& src_data = data_col->get_data(); |
442 | 30 | for (size_t i = 0; i < input_rows_count; ++i) { |
443 | 18 | Int64 n = src_data[i]; |
444 | 18 | if (n < 0 || n > 20) { |
445 | 6 | result_null_map_data[i] = 1; |
446 | 6 | result_data[i] = 0; |
447 | 12 | } else { |
448 | 12 | result_data[i] = FACT_TABLE[n]; |
449 | 12 | } |
450 | 18 | } |
451 | | |
452 | 12 | block.replace_by_position(result, ColumnNullable::create(std::move(result_column), |
453 | 12 | std::move(result_null_map))); |
454 | | |
455 | 12 | return Status::OK(); |
456 | 12 | } |
457 | | }; |
458 | | |
459 | | template <typename A> |
460 | | struct RadiansImpl { |
461 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
462 | | |
463 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
464 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a / 180.0 * |
465 | 4 | PiImpl::value); |
466 | 4 | } Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIsE5applyEs Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIiE5applyEi Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIfE5applyEf _ZN5doris10vectorized11RadiansImplIdE5applyEd Line | Count | Source | 463 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 464 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a / 180.0 * | 465 | 4 | PiImpl::value); | 466 | 4 | } |
|
467 | | }; |
468 | | |
469 | | struct NameRadians { |
470 | | static constexpr auto name = "radians"; |
471 | | }; |
472 | | |
473 | | using FunctionRadians = FunctionUnaryArithmetic<RadiansImpl, NameRadians>; |
474 | | |
475 | | template <typename A> |
476 | | struct DegreesImpl { |
477 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
478 | | |
479 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
480 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a * 180.0 / |
481 | 4 | PiImpl::value); |
482 | 4 | } Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIsE5applyEs Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIiE5applyEi Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIfE5applyEf _ZN5doris10vectorized11DegreesImplIdE5applyEd Line | Count | Source | 479 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 480 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a * 180.0 / | 481 | 4 | PiImpl::value); | 482 | 4 | } |
|
483 | | }; |
484 | | |
485 | | struct NameDegrees { |
486 | | static constexpr auto name = "degrees"; |
487 | | }; |
488 | | |
489 | | using FunctionDegrees = FunctionUnaryArithmetic<DegreesImpl, NameDegrees>; |
490 | | |
491 | | struct NameBin { |
492 | | static constexpr auto name = "bin"; |
493 | | }; |
494 | | struct BinImpl { |
495 | | using ReturnType = DataTypeString; |
496 | | static constexpr auto PrimitiveTypeImpl = PrimitiveType::TYPE_BIGINT; |
497 | | using Type = Int64; |
498 | | using ReturnColumnType = ColumnString; |
499 | | |
500 | 4 | static std::string bin_impl(Int64 value) { |
501 | 4 | auto n = static_cast<uint64_t>(value); |
502 | 4 | const size_t max_bits = sizeof(uint64_t) * 8; |
503 | 4 | char result[max_bits]; |
504 | 4 | uint32_t index = max_bits; |
505 | 7 | do { |
506 | 7 | result[--index] = '0' + (n & 1); |
507 | 7 | } while (n >>= 1); |
508 | 4 | return std::string(result + index, max_bits - index); |
509 | 4 | } |
510 | | |
511 | | static Status vector(const ColumnInt64::Container& data, ColumnString::Chars& res_data, |
512 | 1 | ColumnString::Offsets& res_offsets) { |
513 | 1 | res_offsets.resize(data.size()); |
514 | 1 | size_t input_size = res_offsets.size(); |
515 | | |
516 | 5 | for (size_t i = 0; i < input_size; ++i) { |
517 | 4 | StringOP::push_value_string(bin_impl(data[i]), i, res_data, res_offsets); |
518 | 4 | } |
519 | 1 | return Status::OK(); |
520 | 1 | } |
521 | | }; |
522 | | |
523 | | using FunctionBin = FunctionUnaryToType<BinImpl, NameBin>; |
524 | | |
525 | | struct PowImpl { |
526 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
527 | | static constexpr auto name = "pow"; |
528 | | static constexpr bool need_replace_null_data_to_default = true; |
529 | | static constexpr bool is_nullable = false; |
530 | 4 | static inline double apply(double a, double b) { return std::pow(a, b); } |
531 | | }; |
532 | | struct LogImpl { |
533 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
534 | | static constexpr auto name = "log"; |
535 | | static constexpr bool need_replace_null_data_to_default = false; |
536 | | static constexpr bool is_nullable = true; |
537 | | static constexpr double EPSILON = 1e-9; |
538 | 6 | static inline double apply(double a, double b, UInt8& is_null) { |
539 | 6 | is_null = a <= 0 || b <= 0 || std::fabs(a - 1.0) < EPSILON; |
540 | 6 | return std::log(b) / std::log(a); |
541 | 6 | } |
542 | | }; |
543 | | struct Atan2Impl { |
544 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
545 | | static constexpr auto name = "atan2"; |
546 | | static constexpr bool need_replace_null_data_to_default = false; |
547 | | static constexpr bool is_nullable = false; |
548 | 21 | static inline double apply(double a, double b) { return std::atan2(a, b); } |
549 | | }; |
550 | | |
551 | | template <typename Impl> |
552 | | class FunctionMathBinary : public IFunction { |
553 | | public: |
554 | | using cpp_type = typename PrimitiveTypeTraits<Impl::type>::CppType; |
555 | | using column_type = typename PrimitiveTypeTraits<Impl::type>::ColumnType; |
556 | | |
557 | | static constexpr auto name = Impl::name; |
558 | | static constexpr bool has_variadic_argument = |
559 | | !std::is_void_v<decltype(has_variadic_argument_types(std::declval<Impl>()))>; |
560 | | |
561 | 3 | String get_name() const override { return name; }_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE8get_nameB5cxx11Ev Line | Count | Source | 561 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE8get_nameB5cxx11Ev Line | Count | Source | 561 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE8get_nameB5cxx11Ev Line | Count | Source | 561 | 1 | String get_name() const override { return name; } |
Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE8get_nameB5cxx11Ev |
562 | | |
563 | 54 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); }_ZN5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE6createEv Line | Count | Source | 563 | 21 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE6createEv Line | Count | Source | 563 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
|
564 | | |
565 | 42 | bool is_variadic() const override { return has_variadic_argument; }_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE11is_variadicEv Line | Count | Source | 565 | 20 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE11is_variadicEv Line | Count | Source | 565 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
|
566 | | |
567 | 12 | DataTypes get_variadic_argument_types_impl() const override { |
568 | 12 | if constexpr (has_variadic_argument) { |
569 | 9 | return Impl::get_variadic_argument_types(); |
570 | 9 | } |
571 | 0 | return {}; |
572 | 12 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | | if constexpr (has_variadic_argument) { | 569 | | return Impl::get_variadic_argument_types(); | 570 | | } | 571 | 1 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | | if constexpr (has_variadic_argument) { | 569 | | return Impl::get_variadic_argument_types(); | 570 | | } | 571 | 1 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | | if constexpr (has_variadic_argument) { | 569 | | return Impl::get_variadic_argument_types(); | 570 | | } | 571 | 1 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE32get_variadic_argument_types_implEv Line | Count | Source | 567 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 568 | 1 | if constexpr (has_variadic_argument) { | 569 | 1 | return Impl::get_variadic_argument_types(); | 570 | 1 | } | 571 | 0 | return {}; | 572 | 1 | } |
|
573 | | |
574 | 30 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
575 | 30 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); |
576 | 30 | return Impl::is_nullable ? make_nullable(res) : res; |
577 | 30 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 574 | 19 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 19 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 19 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 19 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 574 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 575 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 576 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 577 | 1 | } |
|
578 | 27 | bool need_replace_null_data_to_default() const override { |
579 | 27 | return Impl::need_replace_null_data_to_default; |
580 | 27 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 16 | bool need_replace_null_data_to_default() const override { | 579 | 16 | return Impl::need_replace_null_data_to_default; | 580 | 16 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 578 | 1 | bool need_replace_null_data_to_default() const override { | 579 | 1 | return Impl::need_replace_null_data_to_default; | 580 | 1 | } |
|
581 | | |
582 | 21 | size_t get_number_of_arguments() const override { return 2; }_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE23get_number_of_argumentsEv Line | Count | Source | 582 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE23get_number_of_argumentsEv Line | Count | Source | 582 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE23get_number_of_argumentsEv Line | Count | Source | 582 | 19 | size_t get_number_of_arguments() const override { return 2; } |
Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE23get_number_of_argumentsEv |
583 | | |
584 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
585 | 27 | uint32_t result, size_t input_rows_count) const override { |
586 | 27 | auto& column_left = block.get_by_position(arguments[0]).column; |
587 | 27 | auto& column_right = block.get_by_position(arguments[1]).column; |
588 | 27 | bool is_const_left = is_column_const(*column_left); |
589 | 27 | bool is_const_right = is_column_const(*column_right); |
590 | | |
591 | 27 | ColumnPtr column_result = nullptr; |
592 | | |
593 | 27 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; |
594 | 27 | if (is_const_left) { |
595 | 5 | column_result = constant_vector(column_left, column_right); |
596 | 22 | } else if (is_const_right) { |
597 | 5 | column_result = vector_constant(column_left, column_right); |
598 | 17 | } else { |
599 | 17 | column_result = vector_vector(column_left, column_right); |
600 | 17 | } |
601 | 27 | block.replace_by_position(result, std::move(column_result)); |
602 | | |
603 | 27 | return Status::OK(); |
604 | 27 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 16 | uint32_t result, size_t input_rows_count) const override { | 586 | 16 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 16 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 16 | bool is_const_left = is_column_const(*column_left); | 589 | 16 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 16 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 16 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 16 | if (is_const_left) { | 595 | 5 | column_result = constant_vector(column_left, column_right); | 596 | 11 | } else if (is_const_right) { | 597 | 5 | column_result = vector_constant(column_left, column_right); | 598 | 6 | } else { | 599 | 6 | column_result = vector_vector(column_left, column_right); | 600 | 6 | } | 601 | 16 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 16 | return Status::OK(); | 604 | 16 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 585 | 1 | uint32_t result, size_t input_rows_count) const override { | 586 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 587 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 588 | 1 | bool is_const_left = is_column_const(*column_left); | 589 | 1 | bool is_const_right = is_column_const(*column_right); | 590 | | | 591 | 1 | ColumnPtr column_result = nullptr; | 592 | | | 593 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 594 | 1 | if (is_const_left) { | 595 | 0 | column_result = constant_vector(column_left, column_right); | 596 | 1 | } else if (is_const_right) { | 597 | 0 | column_result = vector_constant(column_left, column_right); | 598 | 1 | } else { | 599 | 1 | column_result = vector_vector(column_left, column_right); | 600 | 1 | } | 601 | 1 | block.replace_by_position(result, std::move(column_result)); | 602 | | | 603 | 1 | return Status::OK(); | 604 | 1 | } |
|
605 | | |
606 | | private: |
607 | 5 | ColumnPtr vector_constant(ColumnPtr column_left, ColumnPtr column_right) const { |
608 | 5 | const auto* column_right_ptr = assert_cast<const ColumnConst*>(column_right.get()); |
609 | 5 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left.get()); |
610 | 5 | auto column_result = column_type::create(column_left->size()); |
611 | | |
612 | 5 | if constexpr (Impl::is_nullable) { |
613 | 0 | auto null_map = ColumnUInt8::create(column_left->size(), 0); |
614 | 0 | auto& a = column_left_ptr->get_data(); |
615 | 0 | auto& c = column_result->get_data(); |
616 | 0 | auto& n = null_map->get_data(); |
617 | 0 | size_t size = a.size(); |
618 | 0 | for (size_t i = 0; i < size; ++i) { |
619 | 0 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>(), n[i]); |
620 | 0 | } |
621 | 0 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
622 | 5 | } else { |
623 | 5 | auto& a = column_left_ptr->get_data(); |
624 | 5 | auto& c = column_result->get_data(); |
625 | 5 | size_t size = a.size(); |
626 | 10 | for (size_t i = 0; i < size; ++i) { |
627 | 5 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>()); |
628 | 5 | } |
629 | 5 | return column_result; |
630 | 5 | } |
631 | 5 | } Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ _ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 607 | 5 | ColumnPtr vector_constant(ColumnPtr column_left, ColumnPtr column_right) const { | 608 | 5 | const auto* column_right_ptr = assert_cast<const ColumnConst*>(column_right.get()); | 609 | 5 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left.get()); | 610 | 5 | auto column_result = column_type::create(column_left->size()); | 611 | | | 612 | | if constexpr (Impl::is_nullable) { | 613 | | auto null_map = ColumnUInt8::create(column_left->size(), 0); | 614 | | auto& a = column_left_ptr->get_data(); | 615 | | auto& c = column_result->get_data(); | 616 | | auto& n = null_map->get_data(); | 617 | | size_t size = a.size(); | 618 | | for (size_t i = 0; i < size; ++i) { | 619 | | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>(), n[i]); | 620 | | } | 621 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 622 | 5 | } else { | 623 | 5 | auto& a = column_left_ptr->get_data(); | 624 | 5 | auto& c = column_result->get_data(); | 625 | 5 | size_t size = a.size(); | 626 | 10 | for (size_t i = 0; i < size; ++i) { | 627 | 5 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>()); | 628 | 5 | } | 629 | 5 | return column_result; | 630 | 5 | } | 631 | 5 | } |
Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE15vector_constantENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ |
632 | | |
633 | 5 | ColumnPtr constant_vector(ColumnPtr column_left, ColumnPtr column_right) const { |
634 | 5 | const auto* column_left_ptr = assert_cast<const ColumnConst*>(column_left.get()); |
635 | | |
636 | 5 | const auto* column_right_ptr = assert_cast<const column_type*>(column_right.get()); |
637 | 5 | auto column_result = column_type::create(column_right->size()); |
638 | | |
639 | 5 | if constexpr (Impl::is_nullable) { |
640 | 0 | auto null_map = ColumnUInt8::create(column_right->size(), 0); |
641 | 0 | auto& b = column_right_ptr->get_data(); |
642 | 0 | auto& c = column_result->get_data(); |
643 | 0 | auto& n = null_map->get_data(); |
644 | 0 | size_t size = b.size(); |
645 | 0 | for (size_t i = 0; i < size; ++i) { |
646 | 0 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i], n[i]); |
647 | 0 | } |
648 | 0 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
649 | 5 | } else { |
650 | 5 | auto& b = column_right_ptr->get_data(); |
651 | 5 | auto& c = column_result->get_data(); |
652 | 5 | size_t size = b.size(); |
653 | 10 | for (size_t i = 0; i < size; ++i) { |
654 | 5 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i]); |
655 | 5 | } |
656 | 5 | return column_result; |
657 | 5 | } |
658 | 5 | } Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ _ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 633 | 5 | ColumnPtr constant_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 634 | 5 | const auto* column_left_ptr = assert_cast<const ColumnConst*>(column_left.get()); | 635 | | | 636 | 5 | const auto* column_right_ptr = assert_cast<const column_type*>(column_right.get()); | 637 | 5 | auto column_result = column_type::create(column_right->size()); | 638 | | | 639 | | if constexpr (Impl::is_nullable) { | 640 | | auto null_map = ColumnUInt8::create(column_right->size(), 0); | 641 | | auto& b = column_right_ptr->get_data(); | 642 | | auto& c = column_result->get_data(); | 643 | | auto& n = null_map->get_data(); | 644 | | size_t size = b.size(); | 645 | | for (size_t i = 0; i < size; ++i) { | 646 | | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i], n[i]); | 647 | | } | 648 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 649 | 5 | } else { | 650 | 5 | auto& b = column_right_ptr->get_data(); | 651 | 5 | auto& c = column_result->get_data(); | 652 | 5 | size_t size = b.size(); | 653 | 10 | for (size_t i = 0; i < size; ++i) { | 654 | 5 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i]); | 655 | 5 | } | 656 | 5 | return column_result; | 657 | 5 | } | 658 | 5 | } |
Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Unexecuted instantiation: _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE15constant_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ |
659 | | |
660 | 17 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { |
661 | 17 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); |
662 | 17 | const auto* column_right_ptr = |
663 | 17 | assert_cast<const column_type*>(column_right->get_ptr().get()); |
664 | | |
665 | 17 | auto column_result = column_type::create(column_left->size()); |
666 | | |
667 | 17 | if constexpr (Impl::is_nullable) { |
668 | 1 | auto null_map = ColumnUInt8::create(column_result->size(), 0); |
669 | 1 | auto& a = column_left_ptr->get_data(); |
670 | 1 | auto& b = column_right_ptr->get_data(); |
671 | 1 | auto& c = column_result->get_data(); |
672 | 1 | auto& n = null_map->get_data(); |
673 | 1 | size_t size = a.size(); |
674 | 7 | for (size_t i = 0; i < size; ++i) { |
675 | 6 | c[i] = Impl::apply(a[i], b[i], n[i]); |
676 | 6 | } |
677 | 1 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
678 | 16 | } else { |
679 | 16 | auto& a = column_left_ptr->get_data(); |
680 | 16 | auto& b = column_right_ptr->get_data(); |
681 | 16 | auto& c = column_result->get_data(); |
682 | 16 | size_t size = a.size(); |
683 | 65 | for (size_t i = 0; i < size; ++i) { |
684 | 49 | c[i] = Impl::apply(a[i], b[i]); |
685 | 49 | } |
686 | 16 | return column_result; |
687 | 16 | } |
688 | 17 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | 1 | if constexpr (Impl::is_nullable) { | 668 | 1 | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | 1 | auto& a = column_left_ptr->get_data(); | 670 | 1 | auto& b = column_right_ptr->get_data(); | 671 | 1 | auto& c = column_result->get_data(); | 672 | 1 | auto& n = null_map->get_data(); | 673 | 1 | size_t size = a.size(); | 674 | 7 | for (size_t i = 0; i < size; ++i) { | 675 | 6 | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | 6 | } | 677 | 1 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | | } else { | 679 | | auto& a = column_left_ptr->get_data(); | 680 | | auto& b = column_right_ptr->get_data(); | 681 | | auto& c = column_result->get_data(); | 682 | | size_t size = a.size(); | 683 | | for (size_t i = 0; i < size; ++i) { | 684 | | c[i] = Impl::apply(a[i], b[i]); | 685 | | } | 686 | | return column_result; | 687 | | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 5 | for (size_t i = 0; i < size; ++i) { | 684 | 4 | c[i] = Impl::apply(a[i], b[i]); | 685 | 4 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 660 | 6 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 6 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 6 | const auto* column_right_ptr = | 663 | 6 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 6 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 6 | } else { | 679 | 6 | auto& a = column_left_ptr->get_data(); | 680 | 6 | auto& b = column_right_ptr->get_data(); | 681 | 6 | auto& c = column_result->get_data(); | 682 | 6 | size_t size = a.size(); | 683 | 17 | for (size_t i = 0; i < size; ++i) { | 684 | 11 | c[i] = Impl::apply(a[i], b[i]); | 685 | 11 | } | 686 | 6 | return column_result; | 687 | 6 | } | 688 | 6 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 7 | for (size_t i = 0; i < size; ++i) { | 684 | 6 | c[i] = Impl::apply(a[i], b[i]); | 685 | 6 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 9 | for (size_t i = 0; i < size; ++i) { | 684 | 8 | c[i] = Impl::apply(a[i], b[i]); | 685 | 8 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 9 | for (size_t i = 0; i < size; ++i) { | 684 | 8 | c[i] = Impl::apply(a[i], b[i]); | 685 | 8 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 660 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 661 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 662 | 1 | const auto* column_right_ptr = | 663 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 664 | | | 665 | 1 | auto column_result = column_type::create(column_left->size()); | 666 | | | 667 | | if constexpr (Impl::is_nullable) { | 668 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 669 | | auto& a = column_left_ptr->get_data(); | 670 | | auto& b = column_right_ptr->get_data(); | 671 | | auto& c = column_result->get_data(); | 672 | | auto& n = null_map->get_data(); | 673 | | size_t size = a.size(); | 674 | | for (size_t i = 0; i < size; ++i) { | 675 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 676 | | } | 677 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 678 | 1 | } else { | 679 | 1 | auto& a = column_left_ptr->get_data(); | 680 | 1 | auto& b = column_right_ptr->get_data(); | 681 | 1 | auto& c = column_result->get_data(); | 682 | 1 | size_t size = a.size(); | 683 | 3 | for (size_t i = 0; i < size; ++i) { | 684 | 2 | c[i] = Impl::apply(a[i], b[i]); | 685 | 2 | } | 686 | 1 | return column_result; | 687 | 1 | } | 688 | 1 | } |
|
689 | | }; |
690 | | |
691 | | class FunctionNormalCdf : public IFunction { |
692 | | public: |
693 | | static constexpr auto name = "normal_cdf"; |
694 | | |
695 | 1 | String get_name() const override { return name; } |
696 | | |
697 | 2 | static FunctionPtr create() { return std::make_shared<FunctionNormalCdf>(); } |
698 | | |
699 | 0 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
700 | 0 | return make_nullable(std::make_shared<DataTypeFloat64>()); |
701 | 0 | } |
702 | | |
703 | 1 | DataTypes get_variadic_argument_types_impl() const override { |
704 | 1 | return {std::make_shared<DataTypeFloat64>(), std::make_shared<DataTypeFloat64>(), |
705 | 1 | std::make_shared<DataTypeFloat64>()}; |
706 | 1 | } |
707 | 0 | size_t get_number_of_arguments() const override { return 3; } |
708 | | |
709 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
710 | 0 | uint32_t result, size_t input_rows_count) const override { |
711 | 0 | auto result_column = ColumnFloat64::create(input_rows_count); |
712 | 0 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
713 | |
|
714 | 0 | auto& result_data = result_column->get_data(); |
715 | 0 | NullMap& result_null_map = |
716 | 0 | assert_cast<ColumnUInt8*>(result_null_map_column.get())->get_data(); |
717 | |
|
718 | 0 | ColumnPtr argument_columns[3]; |
719 | 0 | bool col_const[3]; |
720 | 0 | size_t argument_size = arguments.size(); |
721 | 0 | for (int i = 0; i < argument_size; ++i) { |
722 | 0 | argument_columns[i] = block.get_by_position(arguments[i]).column; |
723 | 0 | col_const[i] = is_column_const(*argument_columns[i]); |
724 | 0 | if (col_const[i]) { |
725 | 0 | argument_columns[i] = |
726 | 0 | static_cast<const ColumnConst&>(*argument_columns[i]).get_data_column_ptr(); |
727 | 0 | } |
728 | 0 | } |
729 | |
|
730 | 0 | const auto* mean_col = assert_cast<const ColumnFloat64*>(argument_columns[0].get()); |
731 | 0 | const auto* sd_col = assert_cast<const ColumnFloat64*>(argument_columns[1].get()); |
732 | 0 | const auto* value_col = assert_cast<const ColumnFloat64*>(argument_columns[2].get()); |
733 | |
|
734 | 0 | result_column->reserve(input_rows_count); |
735 | 0 | for (size_t i = 0; i < input_rows_count; ++i) { |
736 | 0 | double mean = mean_col->get_element(index_check_const(i, col_const[0])); |
737 | 0 | double sd = sd_col->get_element(index_check_const(i, col_const[1])); |
738 | 0 | double v = value_col->get_element(index_check_const(i, col_const[2])); |
739 | |
|
740 | 0 | if (!check_argument(sd)) [[unlikely]] { |
741 | 0 | result_null_map[i] = true; |
742 | 0 | continue; |
743 | 0 | } |
744 | 0 | result_data[i] = calculate_cell(mean, sd, v); |
745 | 0 | } |
746 | |
|
747 | 0 | block.get_by_position(result).column = |
748 | 0 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
749 | 0 | return Status::OK(); |
750 | 0 | } |
751 | | |
752 | 0 | static bool check_argument(double sd) { return sd > 0; } |
753 | 0 | static double calculate_cell(double mean, double sd, double v) { |
754 | | #ifdef __APPLE__ |
755 | | const double sqrt2 = std::sqrt(2); |
756 | | #else |
757 | 0 | constexpr double sqrt2 = std::numbers::sqrt2; |
758 | 0 | #endif |
759 | |
|
760 | 0 | return 0.5 * (std::erf((v - mean) / (sd * sqrt2)) + 1); |
761 | 0 | } |
762 | | }; |
763 | | |
764 | | template <typename A> |
765 | | struct SignBitImpl { |
766 | | static constexpr PrimitiveType ResultType = TYPE_BOOLEAN; |
767 | | |
768 | 9 | static inline bool apply(A a) { return std::signbit(static_cast<Float64>(a)); }Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIsE5applyEs _ZN5doris10vectorized11SignBitImplIiE5applyEi Line | Count | Source | 768 | 3 | static inline bool apply(A a) { return std::signbit(static_cast<Float64>(a)); } |
Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIfE5applyEf _ZN5doris10vectorized11SignBitImplIdE5applyEd Line | Count | Source | 768 | 6 | static inline bool apply(A a) { return std::signbit(static_cast<Float64>(a)); } |
|
769 | | }; |
770 | | |
771 | | struct NameSignBit { |
772 | | static constexpr auto name = "signbit"; |
773 | | }; |
774 | | |
775 | | using FunctionSignBit = FunctionUnaryArithmetic<SignBitImpl, NameSignBit>; |
776 | | |
777 | 9 | double EvenImpl(double a) { |
778 | 9 | double mag = std::abs(a); |
779 | 9 | double even_mag = 2 * std::ceil(mag / 2); |
780 | 9 | return std::copysign(even_mag, a); |
781 | 9 | } |
782 | | |
783 | | struct NameEven { |
784 | | static constexpr auto name = "even"; |
785 | | }; |
786 | | |
787 | | using FunctionEven = FunctionMathUnary<UnaryFunctionPlain<NameEven, EvenImpl>>; |
788 | | |
789 | | template <PrimitiveType A> |
790 | | struct GcdImpl { |
791 | | using cpp_type = typename PrimitiveTypeTraits<A>::CppType; |
792 | | |
793 | | static constexpr PrimitiveType type = A; |
794 | | static constexpr auto name = "gcd"; |
795 | | static constexpr bool need_replace_null_data_to_default = false; |
796 | | static constexpr bool is_nullable = false; |
797 | | |
798 | 5 | static DataTypes get_variadic_argument_types() { |
799 | 5 | using datatype = typename PrimitiveTypeTraits<A>::DataType; |
800 | 5 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; |
801 | 5 | } _ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE3EE27get_variadic_argument_typesEv Line | Count | Source | 798 | 1 | static DataTypes get_variadic_argument_types() { | 799 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 800 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 801 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE4EE27get_variadic_argument_typesEv Line | Count | Source | 798 | 1 | static DataTypes get_variadic_argument_types() { | 799 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 800 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 801 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE5EE27get_variadic_argument_typesEv Line | Count | Source | 798 | 1 | static DataTypes get_variadic_argument_types() { | 799 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 800 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 801 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE6EE27get_variadic_argument_typesEv Line | Count | Source | 798 | 1 | static DataTypes get_variadic_argument_types() { | 799 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 800 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 801 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE7EE27get_variadic_argument_typesEv Line | Count | Source | 798 | 1 | static DataTypes get_variadic_argument_types() { | 799 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 800 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 801 | 1 | } |
|
802 | | |
803 | 20 | static inline cpp_type apply(cpp_type a, cpp_type b) { |
804 | 20 | return static_cast<cpp_type>(std::gcd(a, b)); |
805 | 20 | } _ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE3EE5applyEaa Line | Count | Source | 803 | 6 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 804 | 6 | return static_cast<cpp_type>(std::gcd(a, b)); | 805 | 6 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE4EE5applyEss Line | Count | Source | 803 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 804 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 805 | 2 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE5EE5applyEii Line | Count | Source | 803 | 8 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 804 | 8 | return static_cast<cpp_type>(std::gcd(a, b)); | 805 | 8 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE6EE5applyEll Line | Count | Source | 803 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 804 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 805 | 2 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE7EE5applyEnn Line | Count | Source | 803 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 804 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 805 | 2 | } |
|
806 | | }; |
807 | | |
808 | | template <PrimitiveType A> |
809 | | struct LcmImpl { |
810 | | using cpp_type = typename PrimitiveTypeTraits<A>::CppType; |
811 | | |
812 | | static constexpr PrimitiveType type = A; |
813 | | static constexpr auto name = "lcm"; |
814 | | static constexpr bool need_replace_null_data_to_default = false; |
815 | | static constexpr bool is_nullable = false; |
816 | | |
817 | 4 | static DataTypes get_variadic_argument_types() { |
818 | 4 | using datatype = typename PrimitiveTypeTraits<A>::DataType; |
819 | 4 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; |
820 | 4 | } _ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE4EE27get_variadic_argument_typesEv Line | Count | Source | 817 | 1 | static DataTypes get_variadic_argument_types() { | 818 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 819 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 820 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE5EE27get_variadic_argument_typesEv Line | Count | Source | 817 | 1 | static DataTypes get_variadic_argument_types() { | 818 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 819 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 820 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE6EE27get_variadic_argument_typesEv Line | Count | Source | 817 | 1 | static DataTypes get_variadic_argument_types() { | 818 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 819 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 820 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE7EE27get_variadic_argument_typesEv Line | Count | Source | 817 | 1 | static DataTypes get_variadic_argument_types() { | 818 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 819 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 820 | 1 | } |
|
821 | | |
822 | 14 | static inline cpp_type apply(cpp_type a, cpp_type b) { |
823 | 14 | return static_cast<cpp_type>(std::lcm(a, b)); |
824 | 14 | } _ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE4EE5applyEss Line | Count | Source | 822 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 823 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 824 | 2 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE5EE5applyEii Line | Count | Source | 822 | 8 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 823 | 8 | return static_cast<cpp_type>(std::lcm(a, b)); | 824 | 8 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE6EE5applyEll Line | Count | Source | 822 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 823 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 824 | 2 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE7EE5applyEnn Line | Count | Source | 822 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 823 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 824 | 2 | } |
|
825 | | }; |
826 | | |
827 | | enum class FloatPointNumberJudgmentType { |
828 | | IsNan = 0, |
829 | | IsInf, |
830 | | }; |
831 | | |
832 | | struct ImplIsNan { |
833 | | static constexpr auto name = "isnan"; |
834 | | static constexpr FloatPointNumberJudgmentType type = FloatPointNumberJudgmentType::IsNan; |
835 | | }; |
836 | | |
837 | | struct ImplIsInf { |
838 | | static constexpr auto name = "isinf"; |
839 | | static constexpr FloatPointNumberJudgmentType type = FloatPointNumberJudgmentType::IsInf; |
840 | | }; |
841 | | |
842 | | template <typename Impl> |
843 | | class FunctionFloatingPointNumberJudgment : public IFunction { |
844 | | public: |
845 | | using IFunction::execute; |
846 | | |
847 | | static constexpr auto name = Impl::name; |
848 | 8 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); }_ZN5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE6createEv Line | Count | Source | 848 | 4 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); } |
_ZN5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE6createEv Line | Count | Source | 848 | 4 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); } |
|
849 | | |
850 | | private: |
851 | 2 | String get_name() const override { return name; }_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE8get_nameB5cxx11Ev Line | Count | Source | 851 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE8get_nameB5cxx11Ev Line | Count | Source | 851 | 1 | String get_name() const override { return name; } |
|
852 | 4 | size_t get_number_of_arguments() const override { return 1; }_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE23get_number_of_argumentsEv Line | Count | Source | 852 | 2 | size_t get_number_of_arguments() const override { return 1; } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE23get_number_of_argumentsEv Line | Count | Source | 852 | 2 | size_t get_number_of_arguments() const override { return 1; } |
|
853 | | |
854 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
855 | 4 | return std::make_shared<DataTypeBool>(); |
856 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 854 | 2 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 855 | 2 | return std::make_shared<DataTypeBool>(); | 856 | 2 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 854 | 2 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 855 | 2 | return std::make_shared<DataTypeBool>(); | 856 | 2 | } |
|
857 | | |
858 | | void execute_impl_with_type(const auto* input_column, |
859 | 4 | DataTypeBool::ColumnType::Container& output, size_t size) const { |
860 | 32 | for (int i = 0; i < size; i++) { |
861 | 28 | auto value = input_column->get_element(i); |
862 | 28 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { |
863 | 14 | output[i] = std::isnan(value); |
864 | 14 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { |
865 | 14 | output[i] = std::isinf(value); |
866 | 14 | } |
867 | 28 | } |
868 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE9EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 859 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 860 | 8 | for (int i = 0; i < size; i++) { | 861 | 7 | auto value = input_column->get_element(i); | 862 | 7 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 863 | 7 | output[i] = std::isnan(value); | 864 | | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 865 | | output[i] = std::isinf(value); | 866 | | } | 867 | 7 | } | 868 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE8EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 859 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 860 | 8 | for (int i = 0; i < size; i++) { | 861 | 7 | auto value = input_column->get_element(i); | 862 | 7 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 863 | 7 | output[i] = std::isnan(value); | 864 | | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 865 | | output[i] = std::isinf(value); | 866 | | } | 867 | 7 | } | 868 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE9EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 859 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 860 | 8 | for (int i = 0; i < size; i++) { | 861 | 7 | auto value = input_column->get_element(i); | 862 | | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 863 | | output[i] = std::isnan(value); | 864 | 7 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 865 | 7 | output[i] = std::isinf(value); | 866 | 7 | } | 867 | 7 | } | 868 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE8EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 859 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 860 | 8 | for (int i = 0; i < size; i++) { | 861 | 7 | auto value = input_column->get_element(i); | 862 | | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 863 | | output[i] = std::isnan(value); | 864 | 7 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 865 | 7 | output[i] = std::isinf(value); | 866 | 7 | } | 867 | 7 | } | 868 | 1 | } |
|
869 | | |
870 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
871 | 4 | uint32_t result, size_t input_rows_count) const override { |
872 | 4 | auto dst = DataTypeBool::ColumnType::create(); |
873 | 4 | auto& dst_data = dst->get_data(); |
874 | 4 | dst_data.resize(input_rows_count); |
875 | 4 | const auto* column = block.get_by_position(arguments[0]).column.get(); |
876 | 4 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { |
877 | 2 | execute_impl_with_type(col_f64, dst_data, input_rows_count); |
878 | 2 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { |
879 | 2 | execute_impl_with_type(col_f32, dst_data, input_rows_count); |
880 | 2 | } else { |
881 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", |
882 | 0 | column->get_name(), get_name()); |
883 | 0 | } |
884 | 4 | block.replace_by_position(result, std::move(dst)); |
885 | 4 | return Status::OK(); |
886 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 871 | 2 | uint32_t result, size_t input_rows_count) const override { | 872 | 2 | auto dst = DataTypeBool::ColumnType::create(); | 873 | 2 | auto& dst_data = dst->get_data(); | 874 | 2 | dst_data.resize(input_rows_count); | 875 | 2 | const auto* column = block.get_by_position(arguments[0]).column.get(); | 876 | 2 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { | 877 | 1 | execute_impl_with_type(col_f64, dst_data, input_rows_count); | 878 | 1 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { | 879 | 1 | execute_impl_with_type(col_f32, dst_data, input_rows_count); | 880 | 1 | } else { | 881 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", | 882 | 0 | column->get_name(), get_name()); | 883 | 0 | } | 884 | 2 | block.replace_by_position(result, std::move(dst)); | 885 | 2 | return Status::OK(); | 886 | 2 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 871 | 2 | uint32_t result, size_t input_rows_count) const override { | 872 | 2 | auto dst = DataTypeBool::ColumnType::create(); | 873 | 2 | auto& dst_data = dst->get_data(); | 874 | 2 | dst_data.resize(input_rows_count); | 875 | 2 | const auto* column = block.get_by_position(arguments[0]).column.get(); | 876 | 2 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { | 877 | 1 | execute_impl_with_type(col_f64, dst_data, input_rows_count); | 878 | 1 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { | 879 | 1 | execute_impl_with_type(col_f32, dst_data, input_rows_count); | 880 | 1 | } else { | 881 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", | 882 | 0 | column->get_name(), get_name()); | 883 | 0 | } | 884 | 2 | block.replace_by_position(result, std::move(dst)); | 885 | 2 | return Status::OK(); | 886 | 2 | } |
|
887 | | }; |
888 | | |
889 | | using FunctionIsNan = FunctionFloatingPointNumberJudgment<ImplIsNan>; |
890 | | using FunctionIsInf = FunctionFloatingPointNumberJudgment<ImplIsInf>; |
891 | | |
892 | 1 | void register_function_math(SimpleFunctionFactory& factory) { |
893 | 1 | factory.register_function<FunctionAcos>(); |
894 | 1 | factory.register_function<FunctionAcosh>(); |
895 | 1 | factory.register_function<FunctionAsin>(); |
896 | 1 | factory.register_function<FunctionAsinh>(); |
897 | 1 | factory.register_function<FunctionAtan>(); |
898 | 1 | factory.register_function<FunctionAtanh>(); |
899 | 1 | factory.register_function<FunctionMathBinary<LogImpl>>(); |
900 | 1 | factory.register_function<FunctionMathBinary<PowImpl>>(); |
901 | 1 | factory.register_function<FunctionMathBinary<Atan2Impl>>(); |
902 | 1 | factory.register_function<FunctionCos>(); |
903 | 1 | factory.register_function<FunctionCosh>(); |
904 | 1 | factory.register_function<FunctionE>(); |
905 | 1 | factory.register_alias("ln", "dlog1"); |
906 | 1 | factory.register_function<FunctionMathLog<ImplLn>>(); |
907 | 1 | factory.register_function<FunctionMathLog<ImplLog2>>(); |
908 | 1 | factory.register_function<FunctionMathLog<ImplLog10>>(); |
909 | 1 | factory.register_alias("log10", "dlog10"); |
910 | 1 | factory.register_function<FunctionPi>(); |
911 | 1 | factory.register_function<FunctionSign>(); |
912 | 1 | factory.register_function<FunctionAbs>(); |
913 | 1 | factory.register_function<FunctionNegative>(); |
914 | 1 | factory.register_function<FunctionPositive>(); |
915 | 1 | factory.register_function<FunctionSin>(); |
916 | 1 | factory.register_function<FunctionSinh>(); |
917 | 1 | factory.register_function<FunctionSqrt>(); |
918 | 1 | factory.register_alias("sqrt", "dsqrt"); |
919 | 1 | factory.register_function<FunctionCbrt>(); |
920 | 1 | factory.register_function<FunctionTan>(); |
921 | 1 | factory.register_function<FunctionTanh>(); |
922 | 1 | factory.register_function<FunctionCot>(); |
923 | 1 | factory.register_function<FunctionSec>(); |
924 | 1 | factory.register_function<FunctionCosec>(); |
925 | 1 | factory.register_alias("pow", "power"); |
926 | 1 | factory.register_alias("pow", "dpow"); |
927 | 1 | factory.register_alias("pow", "fpow"); |
928 | 1 | factory.register_function<FunctionExp>(); |
929 | 1 | factory.register_alias("exp", "dexp"); |
930 | 1 | factory.register_function<FunctionFactorial>(); |
931 | 1 | factory.register_function<FunctionRadians>(); |
932 | 1 | factory.register_function<FunctionDegrees>(); |
933 | 1 | factory.register_function<FunctionBin>(); |
934 | 1 | factory.register_function<FunctionNormalCdf>(); |
935 | 1 | factory.register_function<FunctionSignBit>(); |
936 | 1 | factory.register_function<FunctionEven>(); |
937 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_TINYINT>>>(); |
938 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_SMALLINT>>>(); |
939 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_INT>>>(); |
940 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_BIGINT>>>(); |
941 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_LARGEINT>>>(); |
942 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_SMALLINT>>>(); |
943 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_INT>>>(); |
944 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_BIGINT>>>(); |
945 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_LARGEINT>>>(); |
946 | 1 | factory.register_function<FunctionIsNan>(); |
947 | 1 | factory.register_function<FunctionIsInf>(); |
948 | 1 | } |
949 | | } // namespace doris::vectorized |