pub fn can_arithmetic(lhs: &DataType, op: Operator, rhs: &DataType) -> bool {
    use DataType::*;
    use Operator::*;
    if let (Decimal(_, _), Remainder, Decimal(_, _)) = (lhs, op, rhs) {
        return false;
    };

    matches!(
        (lhs, op, rhs),
        (Int8, _, Int8)
            | (Int16, _, Int16)
            | (Int32, _, Int32)
            | (Int64, _, Int64)
            | (UInt8, _, UInt8)
            | (UInt16, _, UInt16)
            | (UInt32, _, UInt32)
            | (UInt64, _, UInt64)
            | (Float64, _, Float64)
            | (Float32, _, Float32)
            | (Duration(_), _, Duration(_))
            | (Decimal(_, _), _, Decimal(_, _))
            | (Date32, Subtract, Duration(_))
            | (Date32, Add, Duration(_))
            | (Date64, Subtract, Duration(_))
            | (Date64, Add, Duration(_))
            | (Time32(TimeUnit::Millisecond), Subtract, Duration(_))
            | (Time32(TimeUnit::Second), Subtract, Duration(_))
            | (Time32(TimeUnit::Millisecond), Add, Duration(_))
            | (Time32(TimeUnit::Second), Add, Duration(_))
            | (Time64(TimeUnit::Microsecond), Subtract, Duration(_))
            | (Time64(TimeUnit::Nanosecond), Subtract, Duration(_))
            | (Time64(TimeUnit::Microsecond), Add, Duration(_))
            | (Time64(TimeUnit::Nanosecond), Add, Duration(_))
            | (Timestamp(_, _), Subtract, Duration(_))
            | (Timestamp(_, _), Add, Duration(_))
            | (Timestamp(_, _), Add, Interval(IntervalUnit::MonthDayNano))
            | (Timestamp(_, None), Subtract, Timestamp(_, None))
    )
}
/// Checks if an array of type `datatype` can perform basic arithmetic
/// operations. These operations include add, subtract, multiply, divide.
///
/// # Examples
/// ```
/// use arrow2::compute::arithmetics::{can_arithmetic, Operator};
/// use arrow2::datatypes::DataType;
///
/// let data_type = DataType::Int8;
/// assert_eq!(can_arithmetic(&data_type, Operator::Add, &data_type), true);
///
/// let data_type = DataType::LargeBinary;
/// assert_eq!(can_arithmetic(&data_type, Operator::Add, &data_type), false)
/// ```
Checks if an array of type `datatype` can perform basic arithmetic
operations. These operations include add, subtract, multiply, divide.
Checks if an array of type ` datatype ` can perform basic arithmetic operations . These operations include add subtract multiply divide .
pub fn can_arithmetic(lhs: &DataType, op: Operator, rhs: &DataType) -> bool {
    use DataType::*;
    use Operator::*;
    if let (Decimal(_, _), Remainder, Decimal(_, _)) = (lhs, op, rhs) {
        return false;
    };
    matches!(
        (lhs, op, rhs),
        (Int8, _, Int8)
            | (Int16, _, Int16)
            | (Int32, _, Int32)
            | (Int64, _, Int64)
            | (UInt8, _, UInt8)
            | (UInt16, _, UInt16)
            | (UInt32, _, UInt32)
            | (UInt64, _, UInt64)
            | (Float64, _, Float64)
            | (Float32, _, Float32)
            | (Duration(_), _, Duration(_))
            | (Decimal(_, _), _, Decimal(_, _))
            | (Date32, Subtract, Duration(_))
            | (Date32, Add, Duration(_))
            | (Date64, Subtract, Duration(_))
            | (Date64, Add, Duration(_))
            | (Time32(TimeUnit::Millisecond), Subtract, Duration(_))
            | (Time32(TimeUnit::Second), Subtract, Duration(_))
            | (Time32(TimeUnit::Millisecond), Add, Duration(_))
            | (Time32(TimeUnit::Second), Add, Duration(_))
            | (Time64(TimeUnit::Microsecond), Subtract, Duration(_))
            | (Time64(TimeUnit::Nanosecond), Subtract, Duration(_))
            | (Time64(TimeUnit::Microsecond), Add, Duration(_))
            | (Time64(TimeUnit::Nanosecond), Add, Duration(_))
            | (Timestamp(_, _), Subtract, Duration(_))
            | (Timestamp(_, _), Add, Duration(_))
            | (Timestamp(_, _), Add, Interval(IntervalUnit::MonthDayNano))
            | (Timestamp(_, None), Subtract, Timestamp(_, None))
    )
}
pub fn can_arithmetic ( lhs : & DataType , op : Operator , rhs : & DataType ) -> bool { use DataType :: * ; use Operator :: * ; if let ( Decimal ( _ , _ ) , Remainder , Decimal ( _ , _ ) ) = ( lhs , op , rhs ) { return false ; } ; matches ! ( ( lhs op rhs ) ( Int8 Int8 ) ( Int16 Int16 ) ( Int32 Int32 ) ( Int64 Int64 ) ( UInt8 UInt8 ) ( UInt16 UInt16 ) ( UInt32 UInt32 ) ( UInt64 UInt64 ) ( Float64 Float64 ) ( Float32 Float32 ) ( Duration ( ) Duration ( ) ) ( Decimal ( ) Decimal ( ) ) ( Date32 Subtract Duration ( ) ) ( Date32 Add Duration ( ) ) ( Date64 Subtract Duration ( ) ) ( Date64 Add Duration ( ) ) ( Time32 ( TimeUnit Millisecond ) Subtract Duration ( ) ) ( Time32 ( TimeUnit Second ) Subtract Duration ( ) ) ( Time32 ( TimeUnit Millisecond ) Add Duration ( ) ) ( Time32 ( TimeUnit Second ) Add Duration ( ) ) ( Time64 ( TimeUnit Microsecond ) Subtract Duration ( ) ) ( Time64 ( TimeUnit Nanosecond ) Subtract Duration ( ) ) ( Time64 ( TimeUnit Microsecond ) Add Duration ( ) ) ( Time64 ( TimeUnit Nanosecond ) Add Duration ( ) ) ( Timestamp ( ) Subtract Duration ( ) ) ( Timestamp ( ) Add Duration ( ) ) ( Timestamp ( ) Add Interval ( IntervalUnit MonthDayNano ) ) ( Timestamp ( None ) Subtract Timestamp ( None ) ) ) }
Checks if an array of type `datatype` can perform basic arithmetic
operations.
Checks if an array of type ` datatype ` can perform basic arithmetic operations .
lhs
&DataType
op
Operator
rhs
&DataType
lhs
&DataType
op
Operator
rhs
&DataType
examples
```
use arrow2::compute::arithmetics::{can_arithmetic, Operator};
use arrow2::datatypes::DataType.

let data_type = DataType::Int8;
assert_eq!(can_arithmetic(&data_type, Operator::Add, &data_type), true).

let data_type = DataType::LargeBinary;
assert_eq!(can_arithmetic(&data_type, Operator::Add, &data_type), false)
```
` ` ` use arrow2 :: compute :: arithmetics :: { can_arithmetic Operator } ; use arrow2 :: datatypes :: DataType . let data_type = DataType :: Int8 ; assert_eq! ( can_arithmetic ( &data_type Operator :: Add &data_type ) true ) . let data_type = DataType :: LargeBinary ; assert_eq! ( can_arithmetic ( &data_type Operator :: Add &data_type ) false ) ` ` `