Skip to content

Commit

Permalink
Add tests for milliseconds and microseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Jun 5, 2024
1 parent bdbadb9 commit 4212522
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/basic/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,28 @@ pub fn overflowing_timestamps_test() {
}

#[test]
pub fn custom_precision_timestamps_test() {
pub fn second_timestamps_test() {
custom_precision_timestamps_test(TimeUnit::Second)
}

#[test]
pub fn millisecond_timestamps_test() {
custom_precision_timestamps_test(TimeUnit::Millisecond)
}

#[test]
pub fn microsecond_timestamps_test() {
custom_precision_timestamps_test(TimeUnit::Microsecond)
}

fn custom_precision_timestamps_test(time_unit: TimeUnit) {
let path = basic_path("overflowing_timestamps.orc");
let f = File::open(path).expect("no file found");
let reader = ArrowReaderBuilder::try_new(f)
.unwrap()
.with_schema(Arc::new(Schema::new(vec![
Field::new("id", DataType::Int32, true),
Field::new("ts", DataType::Timestamp(TimeUnit::Second, None), true),
Field::new("ts", DataType::Timestamp(time_unit, None), true),
])))
.build();
let batch = reader.collect::<Result<Vec<_>, _>>().unwrap();
Expand Down

0 comments on commit 4212522

Please sign in to comment.