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/26 18:10:25 UTC
[arrow-rs] branch master updated: fix testcases while chrono-tz enabled (#2932)
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 ed5843ece fix testcases while chrono-tz enabled (#2932)
ed5843ece is described below
commit ed5843ecea4591e667f0cb1562c11a9eaea22769
Author: Wei-Ting Kuo <wa...@gmail.com>
AuthorDate: Thu Oct 27 02:10:19 2022 +0800
fix testcases while chrono-tz enabled (#2932)
* fix testcases
* add arrow test with all features
* add chrono-tz in features
* remove chrono-tz
* remove duplicated blocks
---
.github/workflows/arrow.yml | 4 ++--
arrow/src/compute/kernels/cast.rs | 8 ++++----
arrow/src/csv/writer.rs | 19 ++++---------------
3 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/.github/workflows/arrow.yml b/.github/workflows/arrow.yml
index 3c73f9d5c..4c395cf64 100644
--- a/.github/workflows/arrow.yml
+++ b/.github/workflows/arrow.yml
@@ -68,9 +68,9 @@ jobs:
run: cargo test -p arrow-integration-test --all-features
- name: Test arrow
run: cargo test -p arrow
- - name: Test --features=force_validate,prettyprint,ipc_compression,ffi,dyn_cmp_dict,dyn_arith_dict
+ - name: Test --features=force_validate,prettyprint,ipc_compression,ffi,dyn_cmp_dict,dyn_arith_dict,chrono-tz
run: |
- cargo test -p arrow --features=force_validate,prettyprint,ipc_compression,ffi,dyn_cmp_dict,dyn_arith_dict
+ cargo test -p arrow --features=force_validate,prettyprint,ipc_compression,ffi,dyn_cmp_dict,dyn_arith_dict,chrono-tz
- name: Run examples
run: |
# Test arrow examples
diff --git a/arrow/src/compute/kernels/cast.rs b/arrow/src/compute/kernels/cast.rs
index c0b08ecc5..2380aa166 100644
--- a/arrow/src/compute/kernels/cast.rs
+++ b/arrow/src/compute/kernels/cast.rs
@@ -3853,8 +3853,8 @@ mod tests {
let b = cast(&array, &DataType::Utf8).unwrap();
let c = b.as_any().downcast_ref::<StringArray>().unwrap();
assert_eq!(&DataType::Utf8, c.data_type());
- assert_eq!("1997-05-19 00:00:00.005", c.value(0));
- assert_eq!("2018-12-25 00:00:00.001", c.value(1));
+ assert_eq!("1997-05-19 00:00:00.005 +00:00", c.value(0));
+ assert_eq!("2018-12-25 00:00:00.001 +00:00", c.value(1));
assert!(c.is_null(2));
}
@@ -5754,9 +5754,9 @@ mod tests {
let out = cast(&(Arc::new(array) as ArrayRef), &DataType::Utf8).unwrap();
let expected = StringArray::from(vec![
- Some("1970-01-01 20:30:00"),
+ Some("1970-01-01 20:30:00 +10:00"),
None,
- Some("1970-01-02 09:58:59"),
+ Some("1970-01-02 09:58:59 +10:00"),
]);
assert_eq!(
diff --git a/arrow/src/csv/writer.rs b/arrow/src/csv/writer.rs
index 7ab0ae24a..330959096 100644
--- a/arrow/src/csv/writer.rs
+++ b/arrow/src/csv/writer.rs
@@ -524,25 +524,14 @@ mod tests {
let mut buffer: Vec<u8> = vec![];
file.read_to_end(&mut buffer).unwrap();
- let expected = if cfg!(feature = "chrono-tz") {
- r#"c1,c2,c3,c4,c5,c6,c7
-Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34,cupcakes
-consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000+00:00,06:51:20,cupcakes
-sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000+00:00,23:46:03,foo
-Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34,cupcakes
-consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000+00:00,06:51:20,cupcakes
-sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000+00:00,23:46:03,foo
-"#
- } else {
- r#"c1,c2,c3,c4,c5,c6,c7
+ let expected = r#"c1,c2,c3,c4,c5,c6,c7
Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34,cupcakes
consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000,06:51:20,cupcakes
sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34,cupcakes
consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000,06:51:20,cupcakes
sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
-"#
- };
+"#;
assert_eq!(expected.to_string(), String::from_utf8(buffer).unwrap());
}
@@ -646,8 +635,8 @@ sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,foo
}
let left = "c1,c2
-2019-04-18T20:54:47.378000000+10:00,2019-04-18T10:54:47.378000000+00:00
-2021-10-30T17:59:07.000000000+11:00,2021-10-30T06:59:07.000000000+00:00\n";
+2019-04-18T20:54:47.378000000+10:00,2019-04-18T10:54:47.378000000
+2021-10-30T17:59:07.000000000+11:00,2021-10-30T06:59:07.000000000\n";
let right = writer.writer.into_inner().map(|s| s.to_string());
assert_eq!(Some(left.to_string()), right.ok());
}