Skip to content

Commit

Permalink
Cleanup cast kernel (#2846)
Browse files Browse the repository at this point in the history
* Cleanup cast kernel

* Fix timezone handling
  • Loading branch information
tustvold committed Oct 8, 2022
1 parent 5cf46d4 commit 9db7518
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 327 deletions.
7 changes: 6 additions & 1 deletion arrow-array/src/array/primitive_array.rs
Expand Up @@ -769,11 +769,16 @@ impl<T: ArrowTimestampType> PrimitiveArray<T> {

/// Construct a timestamp array with new timezone
pub fn with_timezone(&self, timezone: String) -> Self {
self.with_timezone_opt(Some(timezone))
}

/// Construct a timestamp array with an optional timezone
pub fn with_timezone_opt(&self, timezone: Option<String>) -> Self {
let array_data = unsafe {
self.data
.clone()
.into_builder()
.data_type(DataType::Timestamp(T::get_time_unit(), Some(timezone)))
.data_type(DataType::Timestamp(T::get_time_unit(), timezone))
.build_unchecked()
};
PrimitiveArray::from(array_data)
Expand Down

0 comments on commit 9db7518

Please sign in to comment.