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 2022/10/27 05:05:23 UTC
[arrow-rs] branch master updated: Fix chrono-rs clippy (#2949)
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 d625f0ade Fix chrono-rs clippy (#2949)
d625f0ade is described below
commit d625f0adecbc33c9bd23896ef61bbdcf7cf58d53
Author: Wei-Ting Kuo <wa...@gmail.com>
AuthorDate: Thu Oct 27 13:05:18 2022 +0800
Fix chrono-rs clippy (#2949)
* fix chrono-rs-clippy
* enable chrono-tz in clippy
---
.github/workflows/arrow.yml | 2 +-
arrow/src/compute/kernels/cast.rs | 3 +--
arrow/src/compute/kernels/temporal.rs | 6 ++----
arrow/src/csv/writer.rs | 18 +++++++++---------
4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/arrow.yml b/.github/workflows/arrow.yml
index 4c395cf64..6651b394a 100644
--- a/.github/workflows/arrow.yml
+++ b/.github/workflows/arrow.yml
@@ -207,4 +207,4 @@ jobs:
run: cargo clippy -p arrow-select --all-targets --all-features
- name: Clippy arrow
run: |
- cargo clippy -p arrow --features=prettyprint,csv,ipc,test_utils,ffi,ipc_compression,dyn_cmp_dict,dyn_arith_dict --all-targets -- -D warnings
+ cargo clippy -p arrow --features=prettyprint,csv,ipc,test_utils,ffi,ipc_compression,dyn_cmp_dict,dyn_arith_dict,chrono-tz --all-targets -- -D warnings
diff --git a/arrow/src/compute/kernels/cast.rs b/arrow/src/compute/kernels/cast.rs
index 2380aa166..d354a95f0 100644
--- a/arrow/src/compute/kernels/cast.rs
+++ b/arrow/src/compute/kernels/cast.rs
@@ -5499,8 +5499,7 @@ mod tests {
.with_timezone(tz_name.clone()),
),
Arc::new(
- TimestampNanosecondArray::from(vec![1000, 2000])
- .with_timezone(tz_name.clone()),
+ TimestampNanosecondArray::from(vec![1000, 2000]).with_timezone(tz_name),
),
Arc::new(Date32Array::from(vec![1000, 2000])),
Arc::new(Date64Array::from(vec![1000, 2000])),
diff --git a/arrow/src/compute/kernels/temporal.rs b/arrow/src/compute/kernels/temporal.rs
index abb8b40c2..412adb9a9 100644
--- a/arrow/src/compute/kernels/temporal.rs
+++ b/arrow/src/compute/kernels/temporal.rs
@@ -1178,10 +1178,8 @@ mod tests {
// The offset (difference to UTC) is +11:00. Note that daylight savings is in effect on 2021-10-30.
// When daylight savings is not in effect, Australia/Sydney has an offset difference of +10:00.
- let a = TimestampMillisecondArray::from_opt_vec(
- vec![Some(1635577147000)],
- Some("Australia/Sydney".to_string()),
- );
+ let a = TimestampMillisecondArray::from(vec![Some(1635577147000)])
+ .with_timezone("Australia/Sydney".to_string());
let b = hour(&a).unwrap();
assert_eq!(17, b.value(0));
}
diff --git a/arrow/src/csv/writer.rs b/arrow/src/csv/writer.rs
index 330959096..fb3348d94 100644
--- a/arrow/src/csv/writer.rs
+++ b/arrow/src/csv/writer.rs
@@ -610,19 +610,19 @@ sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
Field::new("c2", DataType::Timestamp(TimeUnit::Millisecond, None), true),
]);
- let c1 = TimestampMillisecondArray::from_opt_vec(
+ let c1 = TimestampMillisecondArray::from(
// 1555584887 converts to 2019-04-18, 20:54:47 in time zone Australia/Sydney (AEST).
// The offset (difference to UTC) is +10:00.
// 1635577147 converts to 2021-10-30 17:59:07 in time zone Australia/Sydney (AEDT)
// The offset (difference to UTC) is +11:00. Note that daylight savings is in effect on 2021-10-30.
//
vec![Some(1555584887378), Some(1635577147000)],
- Some("Australia/Sydney".to_string()),
- );
- let c2 = TimestampMillisecondArray::from_opt_vec(
- vec![Some(1555584887378), Some(1635577147000)],
- None,
- );
+ )
+ .with_timezone("Australia/Sydney".to_string());
+ let c2 = TimestampMillisecondArray::from(vec![
+ Some(1555584887378),
+ Some(1635577147000),
+ ]);
let batch =
RecordBatch::try_new(Arc::new(schema), vec![Arc::new(c1), Arc::new(c2)])
.unwrap();
@@ -711,7 +711,7 @@ sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
];
let c1 = Date32Array::from(vec![3, 2, 1]);
let c2 = Date64Array::from(vec![3, 2, 1]);
- let c3 = TimestampNanosecondArray::from_vec(nanoseconds.clone(), None);
+ let c3 = TimestampNanosecondArray::from(nanoseconds.clone());
let batch = RecordBatch::try_new(
Arc::new(schema.clone()),
@@ -756,7 +756,7 @@ sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
let expected = vec![Some(3), Some(2), Some(1)];
assert_eq!(actual, expected);
let actual = c3.into_iter().collect::<Vec<_>>();
- let expected = nanoseconds.into_iter().map(|x| Some(x)).collect::<Vec<_>>();
+ let expected = nanoseconds.into_iter().map(Some).collect::<Vec<_>>();
assert_eq!(actual, expected);
}
}