findepi commented on code in PR #6906:
URL: https://github.com/apache/arrow-rs/pull/6906#discussion_r1891515817


##########
arrow-arith/src/numeric.rs:
##########
@@ -560,6 +582,29 @@ impl IntervalOp for IntervalYearMonthType {
     fn sub(left: Self::Native, right: Self::Native) -> Result<Self::Native, 
ArrowError> {
         left.sub_checked(right)
     }
+
+    fn mul_int(left: Self::Native, right: i32) -> Result<Self::Native, 
ArrowError> {
+        left.mul_checked(right)
+    }
+
+    fn mul_float(left: Self::Native, right: f64) -> Result<Self::Native, 
ArrowError> {
+        let result = (left as f64 * right).round() as i32;
+        Ok(result)
+    }
+
+    fn div_int(left: Self::Native, right: i32) -> Result<Self::Native, 
ArrowError> {
+        if right == 0 {
+            return Err(ArrowError::DivideByZero);
+        }
+        Ok((left as f64 / right as f64).round() as i32)

Review Comment:
   for division, would `left / right as Self` or something like that work?
   ie remaining in integer arithemtics. for example for math like 
`10000000000000000000000000000000000001 / 1` going thru f64 will change the 
value.



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