andygrove commented on code in PR #2031:
URL: https://github.com/apache/arrow-rs/pull/2031#discussion_r917031658
##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -914,6 +963,60 @@ mod tests {
assert_eq!(17, c.value(4));
}
+ #[test]
+ fn test_date32_month_add() {
+ let a =
Date32Array::from(vec![Date32Type::from_naive_date(NaiveDate::from_ymd(2000,
01, 01))]);
+ let b =
IntervalYearMonthArray::from(vec![IntervalYearMonthType::from(1, 1)]);
+ let c = add_dyn(&a, &b).unwrap();
+ let c = c.as_any().downcast_ref::<Date32Array>().unwrap();
+ assert_eq!(c.value(0),
Date32Type::from_naive_date(NaiveDate::from_ymd(2001, 02, 01)));
+ }
+
+ #[test]
+ fn test_date32_day_time_add() {
+ let a =
Date32Array::from(vec![Date32Type::from_naive_date(NaiveDate::from_ymd(2000,
01, 01))]);
+ let b = IntervalDayTimeArray::from(vec![IntervalDayTimeType::from(1,
1)]);
+ let c = add_dyn(&a, &b).unwrap();
+ let c = c.as_any().downcast_ref::<Date32Array>().unwrap();
+ assert_eq!(c.value(0),
Date32Type::from_naive_date(NaiveDate::from_ymd(2001, 01, 02)));
+ }
+
+ #[test]
+ fn test_date32_month_day_nano_add() {
+ let a =
Date32Array::from(vec![Date32Type::from_naive_date(NaiveDate::from_ymd(2000,
01, 01))]);
+ let b =
IntervalMonthDayNanoArray::from(vec![IntervalMonthDayNanoType::from(1, 1, 1)]);
Review Comment:
nit: it would be easier to determine if the test is correct if we used
different values for each component
```suggestion
let b =
IntervalMonthDayNanoArray::from(vec![IntervalMonthDayNanoType::from(1, 2, 3)]);
```
--
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]