Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: Simlify downcast functions in cast.rs. #8103

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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