You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/04/18 13:44:40 UTC
[arrow-rs] branch master updated: Use Into> for PrimitiveArray::with_timezone (#4097)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 6665512de Use Into<Arc<str>> for PrimitiveArray::with_timezone (#4097)
6665512de is described below
commit 6665512deace028c685660fc2e1f968c0a58b1d0
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Tue Apr 18 09:44:34 2023 -0400
Use Into<Arc<str>> for PrimitiveArray::with_timezone (#4097)
* Use Into<Arc<str>> for PrimitiveArray::with_timezone
* Update test
---
arrow-array/src/array/primitive_array.rs | 2 +-
arrow-json/src/writer.rs | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arrow-array/src/array/primitive_array.rs b/arrow-array/src/array/primitive_array.rs
index febafcc6f..187d7617a 100644
--- a/arrow-array/src/array/primitive_array.rs
+++ b/arrow-array/src/array/primitive_array.rs
@@ -1102,7 +1102,7 @@ impl<T: ArrowTimestampType> PrimitiveArray<T> {
}
/// Construct a timestamp array with new timezone
- pub fn with_timezone(&self, timezone: impl Into<String>) -> Self {
+ pub fn with_timezone(&self, timezone: impl Into<Arc<str>>) -> Self {
self.with_timezone_opt(Some(timezone.into()))
}
diff --git a/arrow-json/src/writer.rs b/arrow-json/src/writer.rs
index 60b212101..a096590ec 100644
--- a/arrow-json/src/writer.rs
+++ b/arrow-json/src/writer.rs
@@ -787,12 +787,12 @@ mod tests {
let arr_secs = TimestampSecondArray::from(vec![Some(ts_secs), None]);
let arr_names = StringArray::from(vec![Some("a"), Some("b")]);
- let tz = "+00:00".to_string();
+ let tz = "+00:00";
- let arr_nanos = arr_nanos.with_timezone(&tz);
- let arr_micros = arr_micros.with_timezone(&tz);
- let arr_millis = arr_millis.with_timezone(&tz);
- let arr_secs = arr_secs.with_timezone(&tz);
+ let arr_nanos = arr_nanos.with_timezone(tz);
+ let arr_micros = arr_micros.with_timezone(tz);
+ let arr_millis = arr_millis.with_timezone(tz);
+ let arr_secs = arr_secs.with_timezone(tz);
let schema = Schema::new(vec![
Field::new("nanos", arr_nanos.data_type().clone(), true),