avantgardnerio commented on code in PR #2031:
URL: https://github.com/apache/arrow-rs/pull/2031#discussion_r917156221
##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -774,6 +778,54 @@ pub fn add_dyn(left: &dyn Array, right: &dyn Array) ->
Result<ArrayRef> {
DataType::Dictionary(_, _) => {
typed_dict_math_op!(left, right, |a, b| a + b, math_op_dict)
}
+ DataType::Date32 => {
+ let l = as_primitive_array::<Date32Type>(left);
+ match right.data_type() {
+ DataType::Interval(IntervalUnit::YearMonth) => {
+ let r = as_primitive_array::<IntervalYearMonthType>(right);
+ let res = math_op(l, r, Date32Type::add_year_months)?;
+ Ok(Arc::new(res))
+ }
+ DataType::Interval(IntervalUnit::DayTime) => {
+ let r = as_primitive_array::<IntervalDayTimeType>(right);
+ let res = math_op(l, r, Date32Type::add_day_time)?;
+ Ok(Arc::new(res))
+ }
+ DataType::Interval(IntervalUnit::MonthDayNano) => {
+ let r =
as_primitive_array::<IntervalMonthDayNanoType>(right);
+ let res = math_op(l, r, Date32Type::add_month_day_nano)?;
+ Ok(Arc::new(res))
+ }
+ t => Err(ArrowError::CastError(format!(
+ "Cannot perform arithmetic operation on arrays of type {}",
+ t
+ ))),
Review Comment:
Fixed.
--
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]