zclllyybb commented on code in PR #52293:
URL: https://github.com/apache/doris/pull/52293#discussion_r2235766561


##########
be/src/vec/functions/math.cpp:
##########
@@ -639,6 +666,75 @@ class FunctionNormalCdf : public IFunction {
     }
 };
 
+template <typename A>
+struct SignBitImpl {
+    static constexpr PrimitiveType ResultType = TYPE_BOOLEAN;
+
+    static inline bool apply(A a) { return 
std::signbit(static_cast<Float64>(a)); }
+};
+
+struct NameSignBit {
+    static constexpr auto name = "signbit";
+};
+
+using FunctionSignBit = FunctionUnaryArithmetic<SignBitImpl, NameSignBit>;
+
+double EvenImpl(double a) {
+    double mag = std::abs(a);
+    double even_mag = 2 * std::ceil(mag / 2);
+    return std::copysign(even_mag, a);
+}
+
+struct NameEven {
+    static constexpr auto name = "even";
+};
+
+using FunctionEven = FunctionMathUnary<UnaryFunctionPlain<NameEven, EvenImpl>>;
+
+template <PrimitiveType A>
+struct GcdImpl {
+    using parameter_cpp_type = typename PrimitiveTypeTraits<A>::CppType;
+
+    static constexpr PrimitiveType return_type = A;
+    static constexpr PrimitiveType parameter_type = A;
+
+    static constexpr auto name = "gcd";
+    static constexpr bool need_replace_null_data_to_default = false;
+    static constexpr bool is_nullable = false;
+
+    static DataTypes get_variadic_argument_types() {
+        using datatype = typename PrimitiveTypeTraits<A>::DataType;
+        return {std::make_shared<datatype>(), std::make_shared<datatype>()};
+    }
+
+    static inline typename PrimitiveTypeTraits<return_type>::CppType 
apply(parameter_cpp_type a,
+                                                                           
parameter_cpp_type b) {
+        return static_cast<typename 
PrimitiveTypeTraits<return_type>::CppType>(std::gcd(a, b));
+    }
+};
+
+template <PrimitiveType A>
+struct LcmImpl {
+    using parameter_cpp_type = typename PrimitiveTypeTraits<A>::CppType;
+
+    static constexpr PrimitiveType return_type = A;

Review Comment:
   dont leave two type. now for any situation, these two type must be same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to