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


##########
arrow-arith/src/arithmetic.rs:
##########
@@ -1165,6 +1167,77 @@ pub fn multiply_dyn_checked(
     }
 }
 
+/// Perform `left * right` operation on two decimal arrays. If either left or 
right value is
+/// null then the result is also null.
+///
+/// This performs decimal multiplication which allows precision loss if an 
exact representation
+/// is not possible for the result, according to the required scale. In the 
case, the result
+/// will be rounded to the required scale.
+///
+/// It is implemented for compatibility with precision loss `multiply` 
function provided by
+/// other data processing engines. For multiplication with precision loss 
detection, use
+/// `multiply` or `multiply_checked` instead.
+pub fn mul_fixed_point_checked(
+    left: &PrimitiveArray<Decimal128Type>,
+    right: &PrimitiveArray<Decimal128Type>,
+    required_scale: i8,
+) -> Result<ArrayRef, ArrowError> {
+    let precision = left.precision();
+    let product_scale = left.scale() + right.scale();
+
+    try_binary::<_, _, _, Decimal128Type>(left, right, |a, b| {
+        let a = i256::from_i128(a);
+        let b = i256::from_i128(b);
+
+        a.checked_mul(b)

Review Comment:
   Yea, it's redundant.



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