edponce commented on a change in pull request #11045:
URL: https://github.com/apache/arrow/pull/11045#discussion_r699859608



##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_numeric.cc
##########
@@ -391,6 +391,49 @@ struct CastFunctor<O, I,
   }
 };
 
+// ----------------------------------------------------------------------
+// Integer to decimal
+
+struct IntegerToDecimal {
+  template <typename OutValue, typename IntegerType>
+  OutValue Call(KernelContext*, IntegerType val, Status* st) const {
+    auto maybe_decimal = OutValue(val).Rescale(0, out_scale_);
+    if (ARROW_PREDICT_TRUE(maybe_decimal.ok())) {
+      return maybe_decimal.MoveValueUnsafe();
+    }
+    *st = maybe_decimal.status();
+    return OutValue{};

Review comment:
       Nit: Other casting kernels simply use
   ```c++
   return {};  // zero
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to