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 2020/06/15 17:07:47 UTC

[GitHub] [arrow] kszucs commented on a change in pull request #7420: ARROW-9022: [C++] Add/Sub/Mul arithmetic kernels with overflow check

kszucs commented on a change in pull request #7420:
URL: https://github.com/apache/arrow/pull/7420#discussion_r440322018



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -60,6 +68,42 @@ struct Add {
   }
 };
 
+struct AddChecked {
+#if __has_builtin(__builtin_add_overflow)
+  template <typename T>
+  static enable_if_integer<T> Call(KernelContext* ctx, T left, T right) {
+    T result;
+    if (__builtin_add_overflow(left, right, &result)) {
+      ctx->SetStatus(Status::Invalid("overflow"));

Review comment:
       Which error should we raise? ExecutionError?




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