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