You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/07 12:23:04 UTC

[GitHub] [arrow] jpedroantunes commented on a change in pull request #10385: ARROW-12858: [C++][Gandiva] Add isNull, isTrue, isFalse, isNotTrue, IsNotFalse and NVL functions on Gandiva

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



##########
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:
       Solved!

##########
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:
       Solved!




-- 
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:
users@infra.apache.org