From cdbf87ae47a4e2b12d76f08138105340097d00f3 Mon Sep 17 00:00:00 2001 From: Emil Ejbyfeldt Date: Thu, 13 Jun 2024 17:07:46 +0200 Subject: [PATCH] Add spec for invalid timezone --- core/src/execution/datafusion/expressions/cast.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/execution/datafusion/expressions/cast.rs b/core/src/execution/datafusion/expressions/cast.rs index 43d546c53..7a71d2017 100644 --- a/core/src/execution/datafusion/expressions/cast.rs +++ b/core/src/execution/datafusion/expressions/cast.rs @@ -1913,4 +1913,17 @@ mod tests { let result = cast.cast_array(Arc::new(timestamps.with_timezone("Europe/Copenhagen"))); assert!(result.is_err()) } + + #[test] + fn test_cast_invalid_timezone() { + let timestamps: PrimitiveArray = vec![i64::MAX].into(); + let cast = Cast::new( + Arc::new(Column::new("a", 0)), + DataType::Date32, + EvalMode::Legacy, + "Not a valid timezone".to_owned(), + ); + let result = cast.cast_array(Arc::new(timestamps.with_timezone("Europe/Copenhagen"))); + assert!(result.is_err()) + } }