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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup cast kernel #2846

Merged
merged 2 commits into from Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to add this method as was delighted to find #2347 @viirya had already added it. Apparently I reviewed it but have no recollection 馃槅

Added an optional variant of it, as for this specific case it makes it easier to work with

}

/// 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