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/09/08 07:23:53 UTC

[GitHub] [arrow] projjal commented on a change in pull request #10742: ARROW-13375: [C++][Gandiva] Implement POSITIVE and NEGATIVE Hive functions on Gandiva

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



##########
File path: cpp/src/gandiva/precompiled/arithmetic_ops.cc
##########
@@ -208,6 +208,22 @@ NUMERIC_FUNCTION(DIVIDE)
 
 #undef DIVIDE
 
+#define POSITIVE(TYPE) \
+  FORCE_INLINE         \
+  gdv_##TYPE positive_##TYPE(gdv_##TYPE in) { return static_cast<gdv_##TYPE>(in); }
+
+NUMERIC_FUNCTION(POSITIVE)
+
+#undef POSITIVE
+
+#define NEGATIVE(TYPE) \
+  FORCE_INLINE         \
+  gdv_##TYPE negative_##TYPE(gdv_##TYPE in) { return static_cast<gdv_##TYPE>(-1 * in); }

Review comment:
       @jpedroantunes Can you address this? -1 * INT_MIN will cause overflow




-- 
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: github-unsubscribe@arrow.apache.org

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