fn _get_supertype(l: &ArrowDataType, r: &ArrowDataType) -> Option<ArrowDataType> {
    use arrow::datatypes::DataType::*;
    // TODO! add largelist and temporal types
    match (l, r) {
        (UInt8, Int8) => Some(Int8),
        (UInt8, Int16) => Some(Int16),
        (UInt8, Int32) => Some(Int32),
        (UInt8, Int64) => Some(Int64),

        (UInt16, Int16) => Some(Int16),
        (UInt16, Int32) => Some(Int32),
        (UInt16, Int64) => Some(Int64),

        (UInt32, Int32) => Some(Int32),
        (UInt32, Int64) => Some(Int64),

        (UInt64, Int64) => Some(Int64),

        (Int8, UInt8) => Some(Int8),

        (Int16, UInt8) => Some(Int16),
        (Int16, UInt16) => Some(Int16),

        (Int32, UInt8) => Some(Int32),
        (Int32, UInt16) => Some(Int32),
        (Int32, UInt32) => Some(Int32),

        (Int64, UInt8) => Some(Int64),
        (Int64, UInt16) => Some(Int64),
        (Int64, UInt32) => Some(Int64),
        (Int64, UInt64) => Some(Int64),

        (UInt8, UInt8) => Some(UInt8),
        (UInt8, UInt16) => Some(UInt16),
        (UInt8, UInt32) => Some(UInt32),
        (UInt8, UInt64) => Some(UInt64),
        (UInt8, Float32) => Some(Float32),
        (UInt8, Float64) => Some(Float64),

        (UInt16, UInt8) => Some(UInt16),
        (UInt16, UInt16) => Some(UInt16),
        (UInt16, UInt32) => Some(UInt32),
        (UInt16, UInt64) => Some(UInt64),
        (UInt16, Float32) => Some(Float32),
        (UInt16, Float64) => Some(Float64),

        (UInt32, UInt8) => Some(UInt32),
        (UInt32, UInt16) => Some(UInt32),
        (UInt32, UInt32) => Some(UInt32),
        (UInt32, UInt64) => Some(UInt64),
        (UInt32, Float32) => Some(Float32),
        (UInt32, Float64) => Some(Float64),

        (UInt64, UInt8) => Some(UInt64),
        (UInt64, UInt16) => Some(UInt64),
        (UInt64, UInt32) => Some(UInt64),
        (UInt64, UInt64) => Some(UInt64),
        (UInt64, Float32) => Some(Float32),
        (UInt64, Float64) => Some(Float64),

        (Int8, Int8) => Some(Int8),
        (Int8, Int16) => Some(Int16),
        (Int8, Int32) => Some(Int32),
        (Int8, Int64) => Some(Int64),
        (Int8, Float32) => Some(Float32),
        (Int8, Float64) => Some(Float64),

        (Int16, Int8) => Some(Int16),
        (Int16, Int16) => Some(Int16),
        (Int16, Int32) => Some(Int32),
        (Int16, Int64) => Some(Int64),
        (Int16, Float32) => Some(Float32),
        (Int16, Float64) => Some(Float64),

        (Int32, Int8) => Some(Int32),
        (Int32, Int16) => Some(Int32),
        (Int32, Int32) => Some(Int32),
        (Int32, Int64) => Some(Int64),
        (Int32, Float32) => Some(Float32),
        (Int32, Float64) => Some(Float64),

        (Int64, Int8) => Some(Int64),
        (Int64, Int16) => Some(Int64),
        (Int64, Int32) => Some(Int64),
        (Int64, Int64) => Some(Int64),
        (Int64, Float32) => Some(Float32),
        (Int64, Float64) => Some(Float64),

        (Float32, Float32) => Some(Float32),
        (Float32, Float64) => Some(Float64),
        (Float64, Float32) => Some(Float64),
        (Float64, Float64) => Some(Float64),

        (Utf8, _) => Some(Utf8),
        (_, Utf8) => Some(Utf8),

        (Boolean, Boolean) => Some(Boolean),

        _ => None,
    }
}
/// Given two datatypes, determine the supertype that both types can safely be cast to
Given two datatypes, determine the supertype that both types can safely be cast to
Given two datatypes determine the supertype that both types can safely be cast to
fn _get_supertype(l: &ArrowDataType, r: &ArrowDataType) -> Option<ArrowDataType> {
    use arrow::datatypes::DataType::*;
    // TODO! add largelist and temporal types
    match (l, r) {
        (UInt8, Int8) => Some(Int8),
        (UInt8, Int16) => Some(Int16),
        (UInt8, Int32) => Some(Int32),
        (UInt8, Int64) => Some(Int64),
        (UInt16, Int16) => Some(Int16),
        (UInt16, Int32) => Some(Int32),
        (UInt16, Int64) => Some(Int64),
        (UInt32, Int32) => Some(Int32),
        (UInt32, Int64) => Some(Int64),
        (UInt64, Int64) => Some(Int64),
        (Int8, UInt8) => Some(Int8),
        (Int16, UInt8) => Some(Int16),
        (Int16, UInt16) => Some(Int16),
        (Int32, UInt8) => Some(Int32),
        (Int32, UInt16) => Some(Int32),
        (Int32, UInt32) => Some(Int32),
        (Int64, UInt8) => Some(Int64),
        (Int64, UInt16) => Some(Int64),
        (Int64, UInt32) => Some(Int64),
        (Int64, UInt64) => Some(Int64),
        (UInt8, UInt8) => Some(UInt8),
        (UInt8, UInt16) => Some(UInt16),
        (UInt8, UInt32) => Some(UInt32),
        (UInt8, UInt64) => Some(UInt64),
        (UInt8, Float32) => Some(Float32),
        (UInt8, Float64) => Some(Float64),
        (UInt16, UInt8) => Some(UInt16),
        (UInt16, UInt16) => Some(UInt16),
        (UInt16, UInt32) => Some(UInt32),
        (UInt16, UInt64) => Some(UInt64),
        (UInt16, Float32) => Some(Float32),
        (UInt16, Float64) => Some(Float64),
        (UInt32, UInt8) => Some(UInt32),
        (UInt32, UInt16) => Some(UInt32),
        (UInt32, UInt32) => Some(UInt32),
        (UInt32, UInt64) => Some(UInt64),
        (UInt32, Float32) => Some(Float32),
        (UInt32, Float64) => Some(Float64),
        (UInt64, UInt8) => Some(UInt64),
        (UInt64, UInt16) => Some(UInt64),
        (UInt64, UInt32) => Some(UInt64),
        (UInt64, UInt64) => Some(UInt64),
        (UInt64, Float32) => Some(Float32),
        (UInt64, Float64) => Some(Float64),
        (Int8, Int8) => Some(Int8),
        (Int8, Int16) => Some(Int16),
        (Int8, Int32) => Some(Int32),
        (Int8, Int64) => Some(Int64),
        (Int8, Float32) => Some(Float32),
        (Int8, Float64) => Some(Float64),
        (Int16, Int8) => Some(Int16),
        (Int16, Int16) => Some(Int16),
        (Int16, Int32) => Some(Int32),
        (Int16, Int64) => Some(Int64),
        (Int16, Float32) => Some(Float32),
        (Int16, Float64) => Some(Float64),
        (Int32, Int8) => Some(Int32),
        (Int32, Int16) => Some(Int32),
        (Int32, Int32) => Some(Int32),
        (Int32, Int64) => Some(Int64),
        (Int32, Float32) => Some(Float32),
        (Int32, Float64) => Some(Float64),
        (Int64, Int8) => Some(Int64),
        (Int64, Int16) => Some(Int64),
        (Int64, Int32) => Some(Int64),
        (Int64, Int64) => Some(Int64),
        (Int64, Float32) => Some(Float32),
        (Int64, Float64) => Some(Float64),
        (Float32, Float32) => Some(Float32),
        (Float32, Float64) => Some(Float64),
        (Float64, Float32) => Some(Float64),
        (Float64, Float64) => Some(Float64),
        (Utf8, _) => Some(Utf8),
        (_, Utf8) => Some(Utf8),
        (Boolean, Boolean) => Some(Boolean),
        _ => None,
    }
}
fn _get_supertype ( l : & ArrowDataType , r : & ArrowDataType ) -> Option < ArrowDataType > { use arrow :: datatypes :: DataType :: * ; // TODO! add largelist and temporal types match ( l , r ) { ( UInt8 , Int8 ) => Some ( Int8 ) , ( UInt8 , Int16 ) => Some ( Int16 ) , ( UInt8 , Int32 ) => Some ( Int32 ) , ( UInt8 , Int64 ) => Some ( Int64 ) , ( UInt16 , Int16 ) => Some ( Int16 ) , ( UInt16 , Int32 ) => Some ( Int32 ) , ( UInt16 , Int64 ) => Some ( Int64 ) , ( UInt32 , Int32 ) => Some ( Int32 ) , ( UInt32 , Int64 ) => Some ( Int64 ) , ( UInt64 , Int64 ) => Some ( Int64 ) , ( Int8 , UInt8 ) => Some ( Int8 ) , ( Int16 , UInt8 ) => Some ( Int16 ) , ( Int16 , UInt16 ) => Some ( Int16 ) , ( Int32 , UInt8 ) => Some ( Int32 ) , ( Int32 , UInt16 ) => Some ( Int32 ) , ( Int32 , UInt32 ) => Some ( Int32 ) , ( Int64 , UInt8 ) => Some ( Int64 ) , ( Int64 , UInt16 ) => Some ( Int64 ) , ( Int64 , UInt32 ) => Some ( Int64 ) , ( Int64 , UInt64 ) => Some ( Int64 ) , ( UInt8 , UInt8 ) => Some ( UInt8 ) , ( UInt8 , UInt16 ) => Some ( UInt16 ) , ( UInt8 , UInt32 ) => Some ( UInt32 ) , ( UInt8 , UInt64 ) => Some ( UInt64 ) , ( UInt8 , Float32 ) => Some ( Float32 ) , ( UInt8 , Float64 ) => Some ( Float64 ) , ( UInt16 , UInt8 ) => Some ( UInt16 ) , ( UInt16 , UInt16 ) => Some ( UInt16 ) , ( UInt16 , UInt32 ) => Some ( UInt32 ) , ( UInt16 , UInt64 ) => Some ( UInt64 ) , ( UInt16 , Float32 ) => Some ( Float32 ) , ( UInt16 , Float64 ) => Some ( Float64 ) , ( UInt32 , UInt8 ) => Some ( UInt32 ) , ( UInt32 , UInt16 ) => Some ( UInt32 ) , ( UInt32 , UInt32 ) => Some ( UInt32 ) , ( UInt32 , UInt64 ) => Some ( UInt64 ) , ( UInt32 , Float32 ) => Some ( Float32 ) , ( UInt32 , Float64 ) => Some ( Float64 ) , ( UInt64 , UInt8 ) => Some ( UInt64 ) , ( UInt64 , UInt16 ) => Some ( UInt64 ) , ( UInt64 , UInt32 ) => Some ( UInt64 ) , ( UInt64 , UInt64 ) => Some ( UInt64 ) , ( UInt64 , Float32 ) => Some ( Float32 ) , ( UInt64 , Float64 ) => Some ( Float64 ) , ( Int8 , Int8 ) => Some ( Int8 ) , ( Int8 , Int16 ) => Some ( Int16 ) , ( Int8 , Int32 ) => Some ( Int32 ) , ( Int8 , Int64 ) => Some ( Int64 ) , ( Int8 , Float32 ) => Some ( Float32 ) , ( Int8 , Float64 ) => Some ( Float64 ) , ( Int16 , Int8 ) => Some ( Int16 ) , ( Int16 , Int16 ) => Some ( Int16 ) , ( Int16 , Int32 ) => Some ( Int32 ) , ( Int16 , Int64 ) => Some ( Int64 ) , ( Int16 , Float32 ) => Some ( Float32 ) , ( Int16 , Float64 ) => Some ( Float64 ) , ( Int32 , Int8 ) => Some ( Int32 ) , ( Int32 , Int16 ) => Some ( Int32 ) , ( Int32 , Int32 ) => Some ( Int32 ) , ( Int32 , Int64 ) => Some ( Int64 ) , ( Int32 , Float32 ) => Some ( Float32 ) , ( Int32 , Float64 ) => Some ( Float64 ) , ( Int64 , Int8 ) => Some ( Int64 ) , ( Int64 , Int16 ) => Some ( Int64 ) , ( Int64 , Int32 ) => Some ( Int64 ) , ( Int64 , Int64 ) => Some ( Int64 ) , ( Int64 , Float32 ) => Some ( Float32 ) , ( Int64 , Float64 ) => Some ( Float64 ) , ( Float32 , Float32 ) => Some ( Float32 ) , ( Float32 , Float64 ) => Some ( Float64 ) , ( Float64 , Float32 ) => Some ( Float64 ) , ( Float64 , Float64 ) => Some ( Float64 ) , ( Utf8 , _ ) => Some ( Utf8 ) , ( _ , Utf8 ) => Some ( Utf8 ) , ( Boolean , Boolean ) => Some ( Boolean ) , _ => None , } }
Given two datatypes, determine the supertype that both types can safely be cast to
Given two datatypes determine the supertype that both types can safely be cast to
l
&ArrowDataType
r
&ArrowDataType
l
&ArrowDataType
r
&ArrowDataType