liyafan82 commented on a change in pull request #7748:
URL: https://github.com/apache/arrow/pull/7748#discussion_r454958337



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -219,48 +219,77 @@ struct MultiplyChecked {
   }
 };
 
+struct Divide {
+  template <typename T>
+  static constexpr enable_if_floating_point<T> Call(KernelContext*, T left, T 
right) {
+    return left / right;
+  }
+
+  template <typename T>
+  static constexpr enable_if_integer<T> Call(KernelContext*, T left, T right) {
+    return left / right;
+  }
+};
+
+struct DivideChecked {
+  template <typename T>
+  static enable_if_integer<T> Call(KernelContext* ctx, T left, T right) {
+    if (right == 0) {
+      ctx->SetStatus(Status::Invalid("divide by 0"));
+      return right;
+    }
+    return Divide::Call(ctx, left, right);
+  }
+
+  template <typename T>
+  static constexpr enable_if_floating_point<T> Call(KernelContext*, T left, T 
right) {
+    return left * right;

Review comment:
       Sorry for my mistake, and thank you for the careful review.
   I have revised it, and added test case to cover it. 




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