rok commented on a change in pull request #9841:
URL: https://github.com/apache/arrow/pull/9841#discussion_r610076383



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -233,6 +236,104 @@ struct DivideChecked {
   }
 };
 
+template <typename T>
+inline T integer_power(KernelContext* ctx, T left, T right) {
+  if (right < 0) {
+    ctx->SetStatus(
+        Status::Invalid("integers to negative integer powers are not 
allowed"));
+  }
+  T result = 1;
+  if (left == 0 && right != 0) {
+    return 0;
+  }
+  while (true) {
+    if (right % 2) {
+      result *= left;

Review comment:
       I got it working finally, thanks!
   I think the issue is related to 16 bit multiplication as per comments in the 
Multiply kernel. I took the same approach and it seems to have help.




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