Skip to content

Commit

Permalink
Simlify downcast functions in cast.rs. (#8103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H authored Nov 9, 2023
1 parent a564af5 commit 1803b25
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions datafusion/common/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,17 @@ pub fn as_timestamp_second_array(array: &dyn Array) -> Result<&TimestampSecondAr
}

// Downcast ArrayRef to IntervalYearMonthArray
pub fn as_interval_ym_array(
array: &dyn Array,
) -> Result<&IntervalYearMonthArray, DataFusionError> {
pub fn as_interval_ym_array(array: &dyn Array) -> Result<&IntervalYearMonthArray> {
Ok(downcast_value!(array, IntervalYearMonthArray))
}

// Downcast ArrayRef to IntervalDayTimeArray
pub fn as_interval_dt_array(
array: &dyn Array,
) -> Result<&IntervalDayTimeArray, DataFusionError> {
pub fn as_interval_dt_array(array: &dyn Array) -> Result<&IntervalDayTimeArray> {
Ok(downcast_value!(array, IntervalDayTimeArray))
}

// Downcast ArrayRef to IntervalMonthDayNanoArray
pub fn as_interval_mdn_array(
array: &dyn Array,
) -> Result<&IntervalMonthDayNanoArray, DataFusionError> {
pub fn as_interval_mdn_array(array: &dyn Array) -> Result<&IntervalMonthDayNanoArray> {
Ok(downcast_value!(array, IntervalMonthDayNanoArray))
}

Expand Down

0 comments on commit 1803b25

Please sign in to comment.