tustvold commented on code in PR #3690:
URL: https://github.com/apache/arrow-rs/pull/3690#discussion_r1103859517
##########
arrow-arith/src/arithmetic.rs:
##########
@@ -1241,6 +1243,74 @@ 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. In the case, the result will be rounded.
+pub fn multiply_decimal(
+ left: &PrimitiveArray<Decimal128Type>,
+ right: &PrimitiveArray<Decimal128Type>,
+) -> Result<ArrayRef, ArrowError> {
+ let precision = left.precision();
+ let mut product_scale = left.scale() + right.scale();
+
+ math_checked_op(left, right, |a, b| {
Review Comment:
Makes sense, I hadn't got to the truncation logic when I wrote this :smile:
--
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]