/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 | | template <typename A> |
392 | | struct RadiansImpl { |
393 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
394 | | |
395 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
396 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a / 180.0 * |
397 | 4 | PiImpl::value); |
398 | 4 | } Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIsE5applyEs Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIiE5applyEi Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized11RadiansImplIfE5applyEf _ZN5doris10vectorized11RadiansImplIdE5applyEd Line | Count | Source | 395 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 396 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a / 180.0 * | 397 | 4 | PiImpl::value); | 398 | 4 | } |
|
399 | | }; |
400 | | |
401 | | struct NameRadians { |
402 | | static constexpr auto name = "radians"; |
403 | | }; |
404 | | |
405 | | using FunctionRadians = FunctionUnaryArithmetic<RadiansImpl, NameRadians>; |
406 | | |
407 | | template <typename A> |
408 | | struct DegreesImpl { |
409 | | static constexpr PrimitiveType ResultType = ResultOfUnaryFunc<A>::ResultType; |
410 | | |
411 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { |
412 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a * 180.0 / |
413 | 4 | PiImpl::value); |
414 | 4 | } Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIsE5applyEs Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIiE5applyEi Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIlE5applyEl Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplInE5applyEn Unexecuted instantiation: _ZN5doris10vectorized11DegreesImplIfE5applyEf _ZN5doris10vectorized11DegreesImplIdE5applyEd Line | Count | Source | 411 | 4 | static inline typename PrimitiveTypeTraits<ResultType>::ColumnItemType apply(A a) { | 412 | 4 | return static_cast<typename PrimitiveTypeTraits<ResultType>::ColumnItemType>(a * 180.0 / | 413 | 4 | PiImpl::value); | 414 | 4 | } |
|
415 | | }; |
416 | | |
417 | | struct NameDegrees { |
418 | | static constexpr auto name = "degrees"; |
419 | | }; |
420 | | |
421 | | using FunctionDegrees = FunctionUnaryArithmetic<DegreesImpl, NameDegrees>; |
422 | | |
423 | | struct NameBin { |
424 | | static constexpr auto name = "bin"; |
425 | | }; |
426 | | struct BinImpl { |
427 | | using ReturnType = DataTypeString; |
428 | | static constexpr auto PrimitiveTypeImpl = PrimitiveType::TYPE_BIGINT; |
429 | | using Type = Int64; |
430 | | using ReturnColumnType = ColumnString; |
431 | | |
432 | 4 | static std::string bin_impl(Int64 value) { |
433 | 4 | auto n = static_cast<uint64_t>(value); |
434 | 4 | const size_t max_bits = sizeof(uint64_t) * 8; |
435 | 4 | char result[max_bits]; |
436 | 4 | uint32_t index = max_bits; |
437 | 7 | do { |
438 | 7 | result[--index] = '0' + (n & 1); |
439 | 7 | } while (n >>= 1); |
440 | 4 | return std::string(result + index, max_bits - index); |
441 | 4 | } |
442 | | |
443 | | static Status vector(const ColumnInt64::Container& data, ColumnString::Chars& res_data, |
444 | 1 | ColumnString::Offsets& res_offsets) { |
445 | 1 | res_offsets.resize(data.size()); |
446 | 1 | size_t input_size = res_offsets.size(); |
447 | | |
448 | 5 | for (size_t i = 0; i < input_size; ++i) { |
449 | 4 | StringOP::push_value_string(bin_impl(data[i]), i, res_data, res_offsets); |
450 | 4 | } |
451 | 1 | return Status::OK(); |
452 | 1 | } |
453 | | }; |
454 | | |
455 | | using FunctionBin = FunctionUnaryToType<BinImpl, NameBin>; |
456 | | |
457 | | struct PowImpl { |
458 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
459 | | static constexpr auto name = "pow"; |
460 | | static constexpr bool need_replace_null_data_to_default = true; |
461 | | static constexpr bool is_nullable = false; |
462 | 4 | static inline double apply(double a, double b) { return std::pow(a, b); } |
463 | | }; |
464 | | struct LogImpl { |
465 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
466 | | static constexpr auto name = "log"; |
467 | | static constexpr bool need_replace_null_data_to_default = false; |
468 | | static constexpr bool is_nullable = true; |
469 | | static constexpr double EPSILON = 1e-9; |
470 | 6 | static inline double apply(double a, double b, UInt8& is_null) { |
471 | 6 | is_null = a <= 0 || b <= 0 || std::fabs(a - 1.0) < EPSILON; |
472 | 6 | return std::log(b) / std::log(a); |
473 | 6 | } |
474 | | }; |
475 | | struct Atan2Impl { |
476 | | static constexpr PrimitiveType type = TYPE_DOUBLE; |
477 | | static constexpr auto name = "atan2"; |
478 | | static constexpr bool need_replace_null_data_to_default = false; |
479 | | static constexpr bool is_nullable = false; |
480 | 21 | static inline double apply(double a, double b) { return std::atan2(a, b); } |
481 | | }; |
482 | | |
483 | | template <typename Impl> |
484 | | class FunctionMathBinary : public IFunction { |
485 | | public: |
486 | | using cpp_type = typename PrimitiveTypeTraits<Impl::type>::CppType; |
487 | | using column_type = typename PrimitiveTypeTraits<Impl::type>::ColumnType; |
488 | | |
489 | | static constexpr auto name = Impl::name; |
490 | | static constexpr bool has_variadic_argument = |
491 | | !std::is_void_v<decltype(has_variadic_argument_types(std::declval<Impl>()))>; |
492 | | |
493 | 3 | String get_name() const override { return name; } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE8get_nameB5cxx11Ev Line | Count | Source | 493 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE8get_nameB5cxx11Ev Line | Count | Source | 493 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE8get_nameB5cxx11Ev Line | Count | Source | 493 | 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 |
494 | | |
495 | 54 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } _ZN5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE6createEv Line | Count | Source | 495 | 21 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
_ZN5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE6createEv Line | Count | Source | 495 | 3 | static FunctionPtr create() { return std::make_shared<FunctionMathBinary<Impl>>(); } |
|
496 | | |
497 | 42 | bool is_variadic() const override { return has_variadic_argument; } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE11is_variadicEv Line | Count | Source | 497 | 20 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE11is_variadicEv Line | Count | Source | 497 | 2 | bool is_variadic() const override { return has_variadic_argument; } |
|
498 | | |
499 | 12 | DataTypes get_variadic_argument_types_impl() const override { |
500 | 12 | if constexpr (has_variadic_argument) { |
501 | 9 | return Impl::get_variadic_argument_types(); |
502 | 9 | } |
503 | 0 | return {}; |
504 | 12 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | | if constexpr (has_variadic_argument) { | 501 | | return Impl::get_variadic_argument_types(); | 502 | | } | 503 | 1 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | | if constexpr (has_variadic_argument) { | 501 | | return Impl::get_variadic_argument_types(); | 502 | | } | 503 | 1 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | | if constexpr (has_variadic_argument) { | 501 | | return Impl::get_variadic_argument_types(); | 502 | | } | 503 | 1 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE32get_variadic_argument_types_implEv Line | Count | Source | 499 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 500 | 1 | if constexpr (has_variadic_argument) { | 501 | 1 | return Impl::get_variadic_argument_types(); | 502 | 1 | } | 503 | 0 | return {}; | 504 | 1 | } |
|
505 | | |
506 | 30 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
507 | 30 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); |
508 | 30 | return Impl::is_nullable ? make_nullable(res) : res; |
509 | 30 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 506 | 19 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 19 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 19 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 19 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaISA_EE Line | Count | Source | 506 | 1 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 507 | 1 | auto res = std::make_shared<DataTypeNumber<Impl::type>>(); | 508 | 1 | return Impl::is_nullable ? make_nullable(res) : res; | 509 | 1 | } |
|
510 | 27 | bool need_replace_null_data_to_default() const override { |
511 | 27 | return Impl::need_replace_null_data_to_default; |
512 | 27 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 16 | bool need_replace_null_data_to_default() const override { | 511 | 16 | return Impl::need_replace_null_data_to_default; | 512 | 16 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE33need_replace_null_data_to_defaultEv Line | Count | Source | 510 | 1 | bool need_replace_null_data_to_default() const override { | 511 | 1 | return Impl::need_replace_null_data_to_default; | 512 | 1 | } |
|
513 | | |
514 | 21 | size_t get_number_of_arguments() const override { return 2; } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE23get_number_of_argumentsEv Line | Count | Source | 514 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE23get_number_of_argumentsEv Line | Count | Source | 514 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE23get_number_of_argumentsEv Line | Count | Source | 514 | 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 |
515 | | |
516 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
517 | 27 | uint32_t result, size_t input_rows_count) const override { |
518 | 27 | auto& column_left = block.get_by_position(arguments[0]).column; |
519 | 27 | auto& column_right = block.get_by_position(arguments[1]).column; |
520 | 27 | bool is_const_left = is_column_const(*column_left); |
521 | 27 | bool is_const_right = is_column_const(*column_right); |
522 | | |
523 | 27 | ColumnPtr column_result = nullptr; |
524 | | |
525 | 27 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; |
526 | 27 | if (is_const_left) { |
527 | 5 | column_result = constant_vector(column_left, column_right); |
528 | 22 | } else if (is_const_right) { |
529 | 5 | column_result = vector_constant(column_left, column_right); |
530 | 17 | } else { |
531 | 17 | column_result = vector_vector(column_left, column_right); |
532 | 17 | } |
533 | 27 | block.replace_by_position(result, std::move(column_result)); |
534 | | |
535 | 27 | return Status::OK(); |
536 | 27 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 16 | uint32_t result, size_t input_rows_count) const override { | 518 | 16 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 16 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 16 | bool is_const_left = is_column_const(*column_left); | 521 | 16 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 16 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 16 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 16 | if (is_const_left) { | 527 | 5 | column_result = constant_vector(column_left, column_right); | 528 | 11 | } else if (is_const_right) { | 529 | 5 | column_result = vector_constant(column_left, column_right); | 530 | 6 | } else { | 531 | 6 | column_result = vector_vector(column_left, column_right); | 532 | 6 | } | 533 | 16 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 16 | return Status::OK(); | 536 | 16 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 517 | 1 | uint32_t result, size_t input_rows_count) const override { | 518 | 1 | auto& column_left = block.get_by_position(arguments[0]).column; | 519 | 1 | auto& column_right = block.get_by_position(arguments[1]).column; | 520 | 1 | bool is_const_left = is_column_const(*column_left); | 521 | 1 | bool is_const_right = is_column_const(*column_right); | 522 | | | 523 | 1 | ColumnPtr column_result = nullptr; | 524 | | | 525 | 1 | DCHECK(!(is_const_left && is_const_right)) << "both of column can not be const"; | 526 | 1 | if (is_const_left) { | 527 | 0 | column_result = constant_vector(column_left, column_right); | 528 | 1 | } else if (is_const_right) { | 529 | 0 | column_result = vector_constant(column_left, column_right); | 530 | 1 | } else { | 531 | 1 | column_result = vector_vector(column_left, column_right); | 532 | 1 | } | 533 | 1 | block.replace_by_position(result, std::move(column_result)); | 534 | | | 535 | 1 | return Status::OK(); | 536 | 1 | } |
|
537 | | |
538 | | private: |
539 | 5 | ColumnPtr vector_constant(ColumnPtr column_left, ColumnPtr column_right) const { |
540 | 5 | const auto* column_right_ptr = assert_cast<const ColumnConst*>(column_right.get()); |
541 | 5 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left.get()); |
542 | 5 | auto column_result = column_type::create(column_left->size()); |
543 | | |
544 | 5 | if constexpr (Impl::is_nullable) { |
545 | 0 | auto null_map = ColumnUInt8::create(column_left->size(), 0); |
546 | 0 | auto& a = column_left_ptr->get_data(); |
547 | 0 | auto& c = column_result->get_data(); |
548 | 0 | auto& n = null_map->get_data(); |
549 | 0 | size_t size = a.size(); |
550 | 0 | for (size_t i = 0; i < size; ++i) { |
551 | 0 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>(), n[i]); |
552 | 0 | } |
553 | 0 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
554 | 5 | } else { |
555 | 5 | auto& a = column_left_ptr->get_data(); |
556 | 5 | auto& c = column_result->get_data(); |
557 | 5 | size_t size = a.size(); |
558 | 10 | for (size_t i = 0; i < size; ++i) { |
559 | 5 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>()); |
560 | 5 | } |
561 | 5 | return column_result; |
562 | 5 | } |
563 | 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 | 539 | 5 | ColumnPtr vector_constant(ColumnPtr column_left, ColumnPtr column_right) const { | 540 | 5 | const auto* column_right_ptr = assert_cast<const ColumnConst*>(column_right.get()); | 541 | 5 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left.get()); | 542 | 5 | auto column_result = column_type::create(column_left->size()); | 543 | | | 544 | | if constexpr (Impl::is_nullable) { | 545 | | auto null_map = ColumnUInt8::create(column_left->size(), 0); | 546 | | auto& a = column_left_ptr->get_data(); | 547 | | auto& c = column_result->get_data(); | 548 | | auto& n = null_map->get_data(); | 549 | | size_t size = a.size(); | 550 | | for (size_t i = 0; i < size; ++i) { | 551 | | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>(), n[i]); | 552 | | } | 553 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 554 | 5 | } else { | 555 | 5 | auto& a = column_left_ptr->get_data(); | 556 | 5 | auto& c = column_result->get_data(); | 557 | 5 | size_t size = a.size(); | 558 | 10 | for (size_t i = 0; i < size; ++i) { | 559 | 5 | c[i] = Impl::apply(a[i], column_right_ptr->template get_value<cpp_type>()); | 560 | 5 | } | 561 | 5 | return column_result; | 562 | 5 | } | 563 | 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_ |
564 | | |
565 | 5 | ColumnPtr constant_vector(ColumnPtr column_left, ColumnPtr column_right) const { |
566 | 5 | const auto* column_left_ptr = assert_cast<const ColumnConst*>(column_left.get()); |
567 | | |
568 | 5 | const auto* column_right_ptr = assert_cast<const column_type*>(column_right.get()); |
569 | 5 | auto column_result = column_type::create(column_right->size()); |
570 | | |
571 | 5 | if constexpr (Impl::is_nullable) { |
572 | 0 | auto null_map = ColumnUInt8::create(column_right->size(), 0); |
573 | 0 | auto& b = column_right_ptr->get_data(); |
574 | 0 | auto& c = column_result->get_data(); |
575 | 0 | auto& n = null_map->get_data(); |
576 | 0 | size_t size = b.size(); |
577 | 0 | for (size_t i = 0; i < size; ++i) { |
578 | 0 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i], n[i]); |
579 | 0 | } |
580 | 0 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
581 | 5 | } else { |
582 | 5 | auto& b = column_right_ptr->get_data(); |
583 | 5 | auto& c = column_result->get_data(); |
584 | 5 | size_t size = b.size(); |
585 | 10 | for (size_t i = 0; i < size; ++i) { |
586 | 5 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i]); |
587 | 5 | } |
588 | 5 | return column_result; |
589 | 5 | } |
590 | 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 | 565 | 5 | ColumnPtr constant_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 566 | 5 | const auto* column_left_ptr = assert_cast<const ColumnConst*>(column_left.get()); | 567 | | | 568 | 5 | const auto* column_right_ptr = assert_cast<const column_type*>(column_right.get()); | 569 | 5 | auto column_result = column_type::create(column_right->size()); | 570 | | | 571 | | if constexpr (Impl::is_nullable) { | 572 | | auto null_map = ColumnUInt8::create(column_right->size(), 0); | 573 | | auto& b = column_right_ptr->get_data(); | 574 | | auto& c = column_result->get_data(); | 575 | | auto& n = null_map->get_data(); | 576 | | size_t size = b.size(); | 577 | | for (size_t i = 0; i < size; ++i) { | 578 | | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i], n[i]); | 579 | | } | 580 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 581 | 5 | } else { | 582 | 5 | auto& b = column_right_ptr->get_data(); | 583 | 5 | auto& c = column_result->get_data(); | 584 | 5 | size_t size = b.size(); | 585 | 10 | for (size_t i = 0; i < size; ++i) { | 586 | 5 | c[i] = Impl::apply(column_left_ptr->template get_value<cpp_type>(), b[i]); | 587 | 5 | } | 588 | 5 | return column_result; | 589 | 5 | } | 590 | 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_ |
591 | | |
592 | 17 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { |
593 | 17 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); |
594 | 17 | const auto* column_right_ptr = |
595 | 17 | assert_cast<const column_type*>(column_right->get_ptr().get()); |
596 | | |
597 | 17 | auto column_result = column_type::create(column_left->size()); |
598 | | |
599 | 17 | if constexpr (Impl::is_nullable) { |
600 | 1 | auto null_map = ColumnUInt8::create(column_result->size(), 0); |
601 | 1 | auto& a = column_left_ptr->get_data(); |
602 | 1 | auto& b = column_right_ptr->get_data(); |
603 | 1 | auto& c = column_result->get_data(); |
604 | 1 | auto& n = null_map->get_data(); |
605 | 1 | size_t size = a.size(); |
606 | 7 | for (size_t i = 0; i < size; ++i) { |
607 | 6 | c[i] = Impl::apply(a[i], b[i], n[i]); |
608 | 6 | } |
609 | 1 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); |
610 | 16 | } else { |
611 | 16 | auto& a = column_left_ptr->get_data(); |
612 | 16 | auto& b = column_right_ptr->get_data(); |
613 | 16 | auto& c = column_result->get_data(); |
614 | 16 | size_t size = a.size(); |
615 | 65 | for (size_t i = 0; i < size; ++i) { |
616 | 49 | c[i] = Impl::apply(a[i], b[i]); |
617 | 49 | } |
618 | 16 | return column_result; |
619 | 16 | } |
620 | 17 | } _ZNK5doris10vectorized18FunctionMathBinaryINS0_7LogImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | 1 | if constexpr (Impl::is_nullable) { | 600 | 1 | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | 1 | auto& a = column_left_ptr->get_data(); | 602 | 1 | auto& b = column_right_ptr->get_data(); | 603 | 1 | auto& c = column_result->get_data(); | 604 | 1 | auto& n = null_map->get_data(); | 605 | 1 | size_t size = a.size(); | 606 | 7 | for (size_t i = 0; i < size; ++i) { | 607 | 6 | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | 6 | } | 609 | 1 | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | | } else { | 611 | | auto& a = column_left_ptr->get_data(); | 612 | | auto& b = column_right_ptr->get_data(); | 613 | | auto& c = column_result->get_data(); | 614 | | size_t size = a.size(); | 615 | | for (size_t i = 0; i < size; ++i) { | 616 | | c[i] = Impl::apply(a[i], b[i]); | 617 | | } | 618 | | return column_result; | 619 | | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7PowImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 5 | for (size_t i = 0; i < size; ++i) { | 616 | 4 | c[i] = Impl::apply(a[i], b[i]); | 617 | 4 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_9Atan2ImplEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS5_EES8_ Line | Count | Source | 592 | 6 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 6 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 6 | const auto* column_right_ptr = | 595 | 6 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 6 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 6 | } else { | 611 | 6 | auto& a = column_left_ptr->get_data(); | 612 | 6 | auto& b = column_right_ptr->get_data(); | 613 | 6 | auto& c = column_result->get_data(); | 614 | 6 | size_t size = a.size(); | 615 | 17 | for (size_t i = 0; i < size; ++i) { | 616 | 11 | c[i] = Impl::apply(a[i], b[i]); | 617 | 11 | } | 618 | 6 | return column_result; | 619 | 6 | } | 620 | 6 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE3EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 7 | for (size_t i = 0; i < size; ++i) { | 616 | 6 | c[i] = Impl::apply(a[i], b[i]); | 617 | 6 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE4EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE5EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 9 | for (size_t i = 0; i < size; ++i) { | 616 | 8 | c[i] = Impl::apply(a[i], b[i]); | 617 | 8 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE6EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7GcdImplILNS_13PrimitiveTypeE7EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE4EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE5EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 9 | for (size_t i = 0; i < size; ++i) { | 616 | 8 | c[i] = Impl::apply(a[i], b[i]); | 617 | 8 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE6EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
_ZNK5doris10vectorized18FunctionMathBinaryINS0_7LcmImplILNS_13PrimitiveTypeE7EEEE13vector_vectorENS_3COWINS0_7IColumnEE13immutable_ptrIS7_EESA_ Line | Count | Source | 592 | 1 | ColumnPtr vector_vector(ColumnPtr column_left, ColumnPtr column_right) const { | 593 | 1 | const auto* column_left_ptr = assert_cast<const column_type*>(column_left->get_ptr().get()); | 594 | 1 | const auto* column_right_ptr = | 595 | 1 | assert_cast<const column_type*>(column_right->get_ptr().get()); | 596 | | | 597 | 1 | auto column_result = column_type::create(column_left->size()); | 598 | | | 599 | | if constexpr (Impl::is_nullable) { | 600 | | auto null_map = ColumnUInt8::create(column_result->size(), 0); | 601 | | auto& a = column_left_ptr->get_data(); | 602 | | auto& b = column_right_ptr->get_data(); | 603 | | auto& c = column_result->get_data(); | 604 | | auto& n = null_map->get_data(); | 605 | | size_t size = a.size(); | 606 | | for (size_t i = 0; i < size; ++i) { | 607 | | c[i] = Impl::apply(a[i], b[i], n[i]); | 608 | | } | 609 | | return ColumnNullable::create(std::move(column_result), std::move(null_map)); | 610 | 1 | } else { | 611 | 1 | auto& a = column_left_ptr->get_data(); | 612 | 1 | auto& b = column_right_ptr->get_data(); | 613 | 1 | auto& c = column_result->get_data(); | 614 | 1 | size_t size = a.size(); | 615 | 3 | for (size_t i = 0; i < size; ++i) { | 616 | 2 | c[i] = Impl::apply(a[i], b[i]); | 617 | 2 | } | 618 | 1 | return column_result; | 619 | 1 | } | 620 | 1 | } |
|
621 | | }; |
622 | | |
623 | | class FunctionNormalCdf : public IFunction { |
624 | | public: |
625 | | static constexpr auto name = "normal_cdf"; |
626 | | |
627 | 1 | String get_name() const override { return name; } |
628 | | |
629 | 2 | static FunctionPtr create() { return std::make_shared<FunctionNormalCdf>(); } |
630 | | |
631 | 0 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
632 | 0 | return make_nullable(std::make_shared<DataTypeFloat64>()); |
633 | 0 | } |
634 | | |
635 | 1 | DataTypes get_variadic_argument_types_impl() const override { |
636 | 1 | return {std::make_shared<DataTypeFloat64>(), std::make_shared<DataTypeFloat64>(), |
637 | 1 | std::make_shared<DataTypeFloat64>()}; |
638 | 1 | } |
639 | 0 | size_t get_number_of_arguments() const override { return 3; } |
640 | | |
641 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
642 | 0 | uint32_t result, size_t input_rows_count) const override { |
643 | 0 | auto result_column = ColumnFloat64::create(input_rows_count); |
644 | 0 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
645 | |
|
646 | 0 | auto& result_data = result_column->get_data(); |
647 | 0 | NullMap& result_null_map = |
648 | 0 | assert_cast<ColumnUInt8*>(result_null_map_column.get())->get_data(); |
649 | |
|
650 | 0 | ColumnPtr argument_columns[3]; |
651 | 0 | bool col_const[3]; |
652 | 0 | size_t argument_size = arguments.size(); |
653 | 0 | for (int i = 0; i < argument_size; ++i) { |
654 | 0 | argument_columns[i] = block.get_by_position(arguments[i]).column; |
655 | 0 | col_const[i] = is_column_const(*argument_columns[i]); |
656 | 0 | if (col_const[i]) { |
657 | 0 | argument_columns[i] = |
658 | 0 | static_cast<const ColumnConst&>(*argument_columns[i]).get_data_column_ptr(); |
659 | 0 | } |
660 | 0 | } |
661 | |
|
662 | 0 | const auto* mean_col = assert_cast<const ColumnFloat64*>(argument_columns[0].get()); |
663 | 0 | const auto* sd_col = assert_cast<const ColumnFloat64*>(argument_columns[1].get()); |
664 | 0 | const auto* value_col = assert_cast<const ColumnFloat64*>(argument_columns[2].get()); |
665 | |
|
666 | 0 | result_column->reserve(input_rows_count); |
667 | 0 | for (size_t i = 0; i < input_rows_count; ++i) { |
668 | 0 | double mean = mean_col->get_element(index_check_const(i, col_const[0])); |
669 | 0 | double sd = sd_col->get_element(index_check_const(i, col_const[1])); |
670 | 0 | double v = value_col->get_element(index_check_const(i, col_const[2])); |
671 | |
|
672 | 0 | if (!check_argument(sd)) [[unlikely]] { |
673 | 0 | result_null_map[i] = true; |
674 | 0 | continue; |
675 | 0 | } |
676 | 0 | result_data[i] = calculate_cell(mean, sd, v); |
677 | 0 | } |
678 | |
|
679 | 0 | block.get_by_position(result).column = |
680 | 0 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
681 | 0 | return Status::OK(); |
682 | 0 | } |
683 | | |
684 | 0 | static bool check_argument(double sd) { return sd > 0; } |
685 | 0 | static double calculate_cell(double mean, double sd, double v) { |
686 | | #ifdef __APPLE__ |
687 | | const double sqrt2 = std::sqrt(2); |
688 | | #else |
689 | 0 | constexpr double sqrt2 = std::numbers::sqrt2; |
690 | 0 | #endif |
691 | |
|
692 | 0 | return 0.5 * (std::erf((v - mean) / (sd * sqrt2)) + 1); |
693 | 0 | } |
694 | | }; |
695 | | |
696 | | template <typename A> |
697 | | struct SignBitImpl { |
698 | | static constexpr PrimitiveType ResultType = TYPE_BOOLEAN; |
699 | | |
700 | 9 | static inline bool apply(A a) { return std::signbit(static_cast<Float64>(a)); } Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIaE5applyEa Unexecuted instantiation: _ZN5doris10vectorized11SignBitImplIsE5applyEs _ZN5doris10vectorized11SignBitImplIiE5applyEi Line | Count | Source | 700 | 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 | 700 | 6 | static inline bool apply(A a) { return std::signbit(static_cast<Float64>(a)); } |
|
701 | | }; |
702 | | |
703 | | struct NameSignBit { |
704 | | static constexpr auto name = "signbit"; |
705 | | }; |
706 | | |
707 | | using FunctionSignBit = FunctionUnaryArithmetic<SignBitImpl, NameSignBit>; |
708 | | |
709 | 9 | double EvenImpl(double a) { |
710 | 9 | double mag = std::abs(a); |
711 | 9 | double even_mag = 2 * std::ceil(mag / 2); |
712 | 9 | return std::copysign(even_mag, a); |
713 | 9 | } |
714 | | |
715 | | struct NameEven { |
716 | | static constexpr auto name = "even"; |
717 | | }; |
718 | | |
719 | | using FunctionEven = FunctionMathUnary<UnaryFunctionPlain<NameEven, EvenImpl>>; |
720 | | |
721 | | template <PrimitiveType A> |
722 | | struct GcdImpl { |
723 | | using cpp_type = typename PrimitiveTypeTraits<A>::CppType; |
724 | | |
725 | | static constexpr PrimitiveType type = A; |
726 | | static constexpr auto name = "gcd"; |
727 | | static constexpr bool need_replace_null_data_to_default = false; |
728 | | static constexpr bool is_nullable = false; |
729 | | |
730 | 5 | static DataTypes get_variadic_argument_types() { |
731 | 5 | using datatype = typename PrimitiveTypeTraits<A>::DataType; |
732 | 5 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; |
733 | 5 | } _ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE3EE27get_variadic_argument_typesEv Line | Count | Source | 730 | 1 | static DataTypes get_variadic_argument_types() { | 731 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 732 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 733 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE4EE27get_variadic_argument_typesEv Line | Count | Source | 730 | 1 | static DataTypes get_variadic_argument_types() { | 731 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 732 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 733 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE5EE27get_variadic_argument_typesEv Line | Count | Source | 730 | 1 | static DataTypes get_variadic_argument_types() { | 731 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 732 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 733 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE6EE27get_variadic_argument_typesEv Line | Count | Source | 730 | 1 | static DataTypes get_variadic_argument_types() { | 731 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 732 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 733 | 1 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE7EE27get_variadic_argument_typesEv Line | Count | Source | 730 | 1 | static DataTypes get_variadic_argument_types() { | 731 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 732 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 733 | 1 | } |
|
734 | | |
735 | 20 | static inline cpp_type apply(cpp_type a, cpp_type b) { |
736 | 20 | return static_cast<cpp_type>(std::gcd(a, b)); |
737 | 20 | } _ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE3EE5applyEaa Line | Count | Source | 735 | 6 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 736 | 6 | return static_cast<cpp_type>(std::gcd(a, b)); | 737 | 6 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE4EE5applyEss Line | Count | Source | 735 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 736 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 737 | 2 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE5EE5applyEii Line | Count | Source | 735 | 8 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 736 | 8 | return static_cast<cpp_type>(std::gcd(a, b)); | 737 | 8 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE6EE5applyEll Line | Count | Source | 735 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 736 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 737 | 2 | } |
_ZN5doris10vectorized7GcdImplILNS_13PrimitiveTypeE7EE5applyEnn Line | Count | Source | 735 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 736 | 2 | return static_cast<cpp_type>(std::gcd(a, b)); | 737 | 2 | } |
|
738 | | }; |
739 | | |
740 | | template <PrimitiveType A> |
741 | | struct LcmImpl { |
742 | | using cpp_type = typename PrimitiveTypeTraits<A>::CppType; |
743 | | |
744 | | static constexpr PrimitiveType type = A; |
745 | | static constexpr auto name = "lcm"; |
746 | | static constexpr bool need_replace_null_data_to_default = false; |
747 | | static constexpr bool is_nullable = false; |
748 | | |
749 | 4 | static DataTypes get_variadic_argument_types() { |
750 | 4 | using datatype = typename PrimitiveTypeTraits<A>::DataType; |
751 | 4 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; |
752 | 4 | } _ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE4EE27get_variadic_argument_typesEv Line | Count | Source | 749 | 1 | static DataTypes get_variadic_argument_types() { | 750 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 751 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 752 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE5EE27get_variadic_argument_typesEv Line | Count | Source | 749 | 1 | static DataTypes get_variadic_argument_types() { | 750 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 751 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 752 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE6EE27get_variadic_argument_typesEv Line | Count | Source | 749 | 1 | static DataTypes get_variadic_argument_types() { | 750 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 751 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 752 | 1 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE7EE27get_variadic_argument_typesEv Line | Count | Source | 749 | 1 | static DataTypes get_variadic_argument_types() { | 750 | 1 | using datatype = typename PrimitiveTypeTraits<A>::DataType; | 751 | 1 | return {std::make_shared<datatype>(), std::make_shared<datatype>()}; | 752 | 1 | } |
|
753 | | |
754 | 14 | static inline cpp_type apply(cpp_type a, cpp_type b) { |
755 | 14 | return static_cast<cpp_type>(std::lcm(a, b)); |
756 | 14 | } _ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE4EE5applyEss Line | Count | Source | 754 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 755 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 756 | 2 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE5EE5applyEii Line | Count | Source | 754 | 8 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 755 | 8 | return static_cast<cpp_type>(std::lcm(a, b)); | 756 | 8 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE6EE5applyEll Line | Count | Source | 754 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 755 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 756 | 2 | } |
_ZN5doris10vectorized7LcmImplILNS_13PrimitiveTypeE7EE5applyEnn Line | Count | Source | 754 | 2 | static inline cpp_type apply(cpp_type a, cpp_type b) { | 755 | 2 | return static_cast<cpp_type>(std::lcm(a, b)); | 756 | 2 | } |
|
757 | | }; |
758 | | |
759 | | enum class FloatPointNumberJudgmentType { |
760 | | IsNan = 0, |
761 | | IsInf, |
762 | | }; |
763 | | |
764 | | struct ImplIsNan { |
765 | | static constexpr auto name = "isnan"; |
766 | | static constexpr FloatPointNumberJudgmentType type = FloatPointNumberJudgmentType::IsNan; |
767 | | }; |
768 | | |
769 | | struct ImplIsInf { |
770 | | static constexpr auto name = "isinf"; |
771 | | static constexpr FloatPointNumberJudgmentType type = FloatPointNumberJudgmentType::IsInf; |
772 | | }; |
773 | | |
774 | | template <typename Impl> |
775 | | class FunctionFloatingPointNumberJudgment : public IFunction { |
776 | | public: |
777 | | using IFunction::execute; |
778 | | |
779 | | static constexpr auto name = Impl::name; |
780 | 8 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); } _ZN5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE6createEv Line | Count | Source | 780 | 4 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); } |
_ZN5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE6createEv Line | Count | Source | 780 | 4 | static FunctionPtr create() { return std::make_shared<FunctionFloatingPointNumberJudgment>(); } |
|
781 | | |
782 | | private: |
783 | 2 | String get_name() const override { return name; } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE8get_nameB5cxx11Ev Line | Count | Source | 783 | 1 | String get_name() const override { return name; } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE8get_nameB5cxx11Ev Line | Count | Source | 783 | 1 | String get_name() const override { return name; } |
|
784 | 4 | size_t get_number_of_arguments() const override { return 1; } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE23get_number_of_argumentsEv Line | Count | Source | 784 | 2 | size_t get_number_of_arguments() const override { return 1; } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE23get_number_of_argumentsEv Line | Count | Source | 784 | 2 | size_t get_number_of_arguments() const override { return 1; } |
|
785 | | |
786 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
787 | 4 | return std::make_shared<DataTypeBool>(); |
788 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 786 | 2 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 787 | 2 | return std::make_shared<DataTypeBool>(); | 788 | 2 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS0_9IDataTypeEESaIS8_EE Line | Count | Source | 786 | 2 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 787 | 2 | return std::make_shared<DataTypeBool>(); | 788 | 2 | } |
|
789 | | |
790 | | void execute_impl_with_type(const auto* input_column, |
791 | 4 | DataTypeBool::ColumnType::Container& output, size_t size) const { |
792 | 32 | for (int i = 0; i < size; i++) { |
793 | 28 | auto value = input_column->get_element(i); |
794 | 28 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { |
795 | 14 | output[i] = std::isnan(value); |
796 | 14 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { |
797 | 14 | output[i] = std::isinf(value); |
798 | 14 | } |
799 | 28 | } |
800 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE9EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 791 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 792 | 8 | for (int i = 0; i < size; i++) { | 793 | 7 | auto value = input_column->get_element(i); | 794 | 7 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 795 | 7 | output[i] = std::isnan(value); | 796 | | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 797 | | output[i] = std::isinf(value); | 798 | | } | 799 | 7 | } | 800 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE8EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 791 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 792 | 8 | for (int i = 0; i < size; i++) { | 793 | 7 | auto value = input_column->get_element(i); | 794 | 7 | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 795 | 7 | output[i] = std::isnan(value); | 796 | | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 797 | | output[i] = std::isinf(value); | 798 | | } | 799 | 7 | } | 800 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE9EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 791 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 792 | 8 | for (int i = 0; i < size; i++) { | 793 | 7 | auto value = input_column->get_element(i); | 794 | | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 795 | | output[i] = std::isnan(value); | 796 | 7 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 797 | 7 | output[i] = std::isinf(value); | 798 | 7 | } | 799 | 7 | } | 800 | 1 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE22execute_impl_with_typeINS0_12ColumnVectorILNS_13PrimitiveTypeE8EEEEEvPKT_RNS0_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEm Line | Count | Source | 791 | 1 | DataTypeBool::ColumnType::Container& output, size_t size) const { | 792 | 8 | for (int i = 0; i < size; i++) { | 793 | 7 | auto value = input_column->get_element(i); | 794 | | if constexpr (Impl::type == FloatPointNumberJudgmentType::IsNan) { | 795 | | output[i] = std::isnan(value); | 796 | 7 | } else if constexpr (Impl::type == FloatPointNumberJudgmentType::IsInf) { | 797 | 7 | output[i] = std::isinf(value); | 798 | 7 | } | 799 | 7 | } | 800 | 1 | } |
|
801 | | |
802 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
803 | 4 | uint32_t result, size_t input_rows_count) const override { |
804 | 4 | auto dst = DataTypeBool::ColumnType::create(); |
805 | 4 | auto& dst_data = dst->get_data(); |
806 | 4 | dst_data.resize(input_rows_count); |
807 | 4 | const auto* column = block.get_by_position(arguments[0]).column.get(); |
808 | 4 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { |
809 | 2 | execute_impl_with_type(col_f64, dst_data, input_rows_count); |
810 | 2 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { |
811 | 2 | execute_impl_with_type(col_f32, dst_data, input_rows_count); |
812 | 2 | } else { |
813 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", |
814 | 0 | column->get_name(), get_name()); |
815 | 0 | } |
816 | 4 | block.replace_by_position(result, std::move(dst)); |
817 | 4 | return Status::OK(); |
818 | 4 | } _ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsNanEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 803 | 2 | uint32_t result, size_t input_rows_count) const override { | 804 | 2 | auto dst = DataTypeBool::ColumnType::create(); | 805 | 2 | auto& dst_data = dst->get_data(); | 806 | 2 | dst_data.resize(input_rows_count); | 807 | 2 | const auto* column = block.get_by_position(arguments[0]).column.get(); | 808 | 2 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { | 809 | 1 | execute_impl_with_type(col_f64, dst_data, input_rows_count); | 810 | 1 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { | 811 | 1 | execute_impl_with_type(col_f32, dst_data, input_rows_count); | 812 | 1 | } else { | 813 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", | 814 | 0 | column->get_name(), get_name()); | 815 | 0 | } | 816 | 2 | block.replace_by_position(result, std::move(dst)); | 817 | 2 | return Status::OK(); | 818 | 2 | } |
_ZNK5doris10vectorized35FunctionFloatingPointNumberJudgmentINS0_9ImplIsInfEE12execute_implEPNS_15FunctionContextERNS0_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 803 | 2 | uint32_t result, size_t input_rows_count) const override { | 804 | 2 | auto dst = DataTypeBool::ColumnType::create(); | 805 | 2 | auto& dst_data = dst->get_data(); | 806 | 2 | dst_data.resize(input_rows_count); | 807 | 2 | const auto* column = block.get_by_position(arguments[0]).column.get(); | 808 | 2 | if (const auto* col_f64 = check_and_get_column<ColumnFloat64>(column)) { | 809 | 1 | execute_impl_with_type(col_f64, dst_data, input_rows_count); | 810 | 1 | } else if (const auto* col_f32 = check_and_get_column<ColumnFloat32>(column)) { | 811 | 1 | execute_impl_with_type(col_f32, dst_data, input_rows_count); | 812 | 1 | } else { | 813 | 0 | return Status::InvalidArgument("Unsupported column type {} for function {}", | 814 | 0 | column->get_name(), get_name()); | 815 | 0 | } | 816 | 2 | block.replace_by_position(result, std::move(dst)); | 817 | 2 | return Status::OK(); | 818 | 2 | } |
|
819 | | }; |
820 | | |
821 | | using FunctionIsNan = FunctionFloatingPointNumberJudgment<ImplIsNan>; |
822 | | using FunctionIsInf = FunctionFloatingPointNumberJudgment<ImplIsInf>; |
823 | | |
824 | 1 | void register_function_math(SimpleFunctionFactory& factory) { |
825 | 1 | factory.register_function<FunctionAcos>(); |
826 | 1 | factory.register_function<FunctionAcosh>(); |
827 | 1 | factory.register_function<FunctionAsin>(); |
828 | 1 | factory.register_function<FunctionAsinh>(); |
829 | 1 | factory.register_function<FunctionAtan>(); |
830 | 1 | factory.register_function<FunctionAtanh>(); |
831 | 1 | factory.register_function<FunctionMathBinary<LogImpl>>(); |
832 | 1 | factory.register_function<FunctionMathBinary<PowImpl>>(); |
833 | 1 | factory.register_function<FunctionMathBinary<Atan2Impl>>(); |
834 | 1 | factory.register_function<FunctionCos>(); |
835 | 1 | factory.register_function<FunctionCosh>(); |
836 | 1 | factory.register_function<FunctionE>(); |
837 | 1 | factory.register_alias("ln", "dlog1"); |
838 | 1 | factory.register_function<FunctionMathLog<ImplLn>>(); |
839 | 1 | factory.register_function<FunctionMathLog<ImplLog2>>(); |
840 | 1 | factory.register_function<FunctionMathLog<ImplLog10>>(); |
841 | 1 | factory.register_alias("log10", "dlog10"); |
842 | 1 | factory.register_function<FunctionPi>(); |
843 | 1 | factory.register_function<FunctionSign>(); |
844 | 1 | factory.register_function<FunctionAbs>(); |
845 | 1 | factory.register_function<FunctionNegative>(); |
846 | 1 | factory.register_function<FunctionPositive>(); |
847 | 1 | factory.register_function<FunctionSin>(); |
848 | 1 | factory.register_function<FunctionSinh>(); |
849 | 1 | factory.register_function<FunctionSqrt>(); |
850 | 1 | factory.register_alias("sqrt", "dsqrt"); |
851 | 1 | factory.register_function<FunctionCbrt>(); |
852 | 1 | factory.register_function<FunctionTan>(); |
853 | 1 | factory.register_function<FunctionTanh>(); |
854 | 1 | factory.register_function<FunctionCot>(); |
855 | 1 | factory.register_function<FunctionSec>(); |
856 | 1 | factory.register_function<FunctionCosec>(); |
857 | 1 | factory.register_alias("pow", "power"); |
858 | 1 | factory.register_alias("pow", "dpow"); |
859 | 1 | factory.register_alias("pow", "fpow"); |
860 | 1 | factory.register_function<FunctionExp>(); |
861 | 1 | factory.register_alias("exp", "dexp"); |
862 | 1 | factory.register_function<FunctionRadians>(); |
863 | 1 | factory.register_function<FunctionDegrees>(); |
864 | 1 | factory.register_function<FunctionBin>(); |
865 | 1 | factory.register_function<FunctionNormalCdf>(); |
866 | 1 | factory.register_function<FunctionSignBit>(); |
867 | 1 | factory.register_function<FunctionEven>(); |
868 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_TINYINT>>>(); |
869 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_SMALLINT>>>(); |
870 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_INT>>>(); |
871 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_BIGINT>>>(); |
872 | 1 | factory.register_function<FunctionMathBinary<GcdImpl<TYPE_LARGEINT>>>(); |
873 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_SMALLINT>>>(); |
874 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_INT>>>(); |
875 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_BIGINT>>>(); |
876 | 1 | factory.register_function<FunctionMathBinary<LcmImpl<TYPE_LARGEINT>>>(); |
877 | 1 | factory.register_function<FunctionIsNan>(); |
878 | 1 | factory.register_function<FunctionIsInf>(); |
879 | 1 | } |
880 | | } // namespace doris::vectorized |