Skip to content

Commit 8cd5d2e

Browse files
committed
CI Fix.
1 parent be7385c commit 8cd5d2e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

datafusion/functions/src/datetime/date_part.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use datafusion_common::{
4646
exec_err, internal_err, not_impl_err,
4747
types::logical_string,
4848
utils::take_function_args,
49-
Result, ScalarValue,
49+
DataFusionError, Result, ScalarValue,
5050
};
5151
use datafusion_expr::{
5252
ColumnarValue, Documentation, ReturnFieldArgs, ScalarUDFImpl, Signature,
@@ -236,10 +236,9 @@ impl ScalarUDFImpl for DatePartFunc {
236236
}
237237
} else if let Timestamp(time_unit, None) = array.data_type() {
238238
// For naive timestamps, interpret in session timezone
239-
let tz = match config.execution.time_zone.parse::<Tz>() {
240-
Ok(tz) => tz,
241-
Err(_) => return exec_err!("Invalid timezone"),
242-
};
239+
let tz: Tz = config.execution.time_zone.parse().map_err(|_| {
240+
DataFusionError::Execution("Invalid timezone".to_string())
241+
})?;
243242
match time_unit {
244243
Nanosecond => {
245244
adjust_timestamp_array::<TimestampNanosecondType>(&array, tz)?

0 commit comments

Comments
 (0)