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


##########
arrow-arith/src/numeric.rs:
##########
@@ -550,6 +568,21 @@ date!(Date64Type);
 trait IntervalOp: ArrowPrimitiveType {
     fn add(left: Self::Native, right: Self::Native) -> Result<Self::Native, 
ArrowError>;
     fn sub(left: Self::Native, right: Self::Native) -> Result<Self::Native, 
ArrowError>;
+    fn mul_int(left: Self::Native, right: i32) -> Result<Self::Native, 
ArrowError>;
+    fn mul_float(left: Self::Native, right: f64) -> Result<Self::Native, 
ArrowError>;
+    fn div_int(left: Self::Native, right: i32) -> Result<Self::Native, 
ArrowError>;
+    fn div_float(left: Self::Native, right: f64) -> Result<Self::Native, 
ArrowError>;

Review Comment:
   The main point of my suggestion is to think of these operations in terms of 
whole-array operations instead of single-value operations.
   
   To treat the interval components separately, we would only need functions 
that split an array of interval values into multiple arrays (each per 
component) so that all the arithmetic can be delegated to existing arithmetic 
operations for all int/float combinations. 



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