viirya commented on code in PR #2923:
URL: https://github.com/apache/arrow-rs/pull/2923#discussion_r1007263742


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -336,10 +356,25 @@ where
 
     // with_precision_and_scale validates the
     // value is within range for the output precision
-    cast_primitive_to_decimal(array, |v| v.as_() * mul, precision, scale)
+    cast_primitive_to_decimal128(array, |v| v.as_() * mul, precision, scale)
+}
+
+fn cast_integer_to_decimal256<T: ArrowNumericType>(
+    array: &PrimitiveArray<T>,
+    precision: u8,
+    scale: u8,
+) -> Result<ArrayRef>
+where
+    <T as ArrowPrimitiveType>::Native: AsPrimitive<i256>,
+{
+    let mul: i256 = i256::from_i128(10_i128.pow(scale as u32));
+
+    // with_precision_and_scale validates the
+    // value is within range for the output precision
+    cast_primitive_to_decimal256(array, |v| v.as_().wrapping_mul(mul), 
precision, scale)

Review Comment:
   We can fix decimal128 together later.



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