milevin commented on code in PR #6906:
URL: https://github.com/apache/arrow-rs/pull/6906#discussion_r1891432608
##########
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)
+ }
+
+ fn div_float(left: Self::Native, right: f64) -> Result<Self::Native,
ArrowError> {
+ if right == 0.0 {
+ return Err(ArrowError::DivideByZero);
+ }
+ Ok((left as f64 / right).round() as i32)
Review Comment:
Good point; I've cleaned it up a bit
--
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]