diff --git a/arrow/src/compute/kernels/cast.rs b/arrow/src/compute/kernels/cast.rs index d7562a6da667..a119ab92f8ba 100644 --- a/arrow/src/compute/kernels/cast.rs +++ b/arrow/src/compute/kernels/cast.rs @@ -90,6 +90,7 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool { | Int64 | UInt64 | Float64 + | Decimal(_, _) | Date64 | Timestamp(_, _) | Time64(_) @@ -121,6 +122,7 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool { | Int64 | UInt64 | Float64 + | Decimal(_, _) | Date64 | Timestamp(_, _) | Time64(_) @@ -447,6 +449,7 @@ pub fn cast_with_options( Float64 => { cast_decimal_to_float!(array, scale, Float64Builder, f64) } + Null => Ok(new_null_array(to_type, array.len())), _ => Err(ArrowError::CastError(format!( "Casting from {:?} to {:?} not supported", from_type, to_type @@ -475,6 +478,7 @@ pub fn cast_with_options( Float64 => { cast_floating_point_to_decimal!(array, Float64Array, precision, scale) } + Null => Ok(new_null_array(to_type, array.len())), _ => Err(ArrowError::CastError(format!( "Casting from {:?} to {:?} not supported", from_type, to_type