Skip to content

Commit

Permalink
feat: Support cast between Decimal and Null
Browse files Browse the repository at this point in the history
Can drop this after rebase on commit 9e8c1bf "Support casting NULL to/from Decimal (apache#1922)", first released in 17.0.0
  • Loading branch information
MazterQyou authored and mcheshkov committed Aug 21, 2024
1 parent 75e78a8 commit 796bfcc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arrow/src/compute/kernels/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool {
| Int64
| UInt64
| Float64
| Decimal(_, _)
| Date64
| Timestamp(_, _)
| Time64(_)
Expand Down Expand Up @@ -121,6 +122,7 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool {
| Int64
| UInt64
| Float64
| Decimal(_, _)
| Date64
| Timestamp(_, _)
| Time64(_)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 796bfcc

Please sign in to comment.