projjal commented on a change in pull request #10385:
URL: https://github.com/apache/arrow/pull/10385#discussion_r646145879



##########
File path: cpp/src/gandiva/function_registry_math_ops.cc
##########
@@ -84,6 +84,17 @@ std::vector<NativeFunction> GetMathOpsFunctionRegistry() {
       BINARY_GENERIC_SAFE_NULL_IF_NULL(truncate, {"trunc"}, decimal128, int32,
                                        decimal128),
 
+      NativeFunction("nvl", {}, DataTypeVector{int32(), int32()}, int32(),

Review comment:
       nit: can use an existing macro for this

##########
File path: cpp/src/gandiva/precompiled/arithmetic_ops.cc
##########
@@ -156,6 +170,17 @@ NUMERIC_TYPES(VALIDITY_OP, isnumeric, +)
   DATE_FUNCTION(INNER)                    \
   INNER(boolean)
 
+#define NVL(TYPE)                                                              
     \
+  FORCE_INLINE                                                                 
     \
+  gdv_##TYPE nvl_##TYPE##_##TYPE(gdv_##TYPE in, gdv_boolean is_valid_in,       
     \
+                                 gdv_##TYPE replace, gdv_boolean 
is_valid_value) {  \
+    return (is_valid_in ? in : replace);                                       
     \
+  }
+
+NUMERIC_BOOL_DATE_FUNCTION(NVL)
+
+#undef VALIDITY_OP

Review comment:
       undef NVL?




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to