Skip to content

Commit

Permalink
Add spec for invalid timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
eejbyfeldt committed Jun 13, 2024
1 parent 2ba65b9 commit cdbf87a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/src/execution/datafusion/expressions/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimestampMicrosecondType> = 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())
}
}

0 comments on commit cdbf87a

Please sign in to comment.