Skip to content

Commit

Permalink
dont compare timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxen committed Apr 11, 2024
1 parent 17ea6dd commit da3b672
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/vtab/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,11 @@ mod test {
let rb = stmt.query_arrow(param)?.next().expect("no record batch");

let output_any_array = rb.column(0);
assert_eq!(output_any_array.data_type(), expected_array.data_type());
match (output_any_array.data_type(), expected_array.data_type()) {
// TODO: DuckDB doesnt return timestamp_tz properly yet, so we just check that the units are the same
(DataType::Timestamp(unit_a, _), DataType::Timestamp(unit_b, _)) => assert_eq!(unit_a, unit_b),
(a, b) => assert_eq!(a, b),
}

let maybe_output_array = output_any_array.as_primitive_opt::<T2>();

Expand Down Expand Up @@ -661,23 +665,23 @@ mod test {
// driver doesnt support timestamp_tz properly when reading. In the
// future we should be able to roundtrip timestamp_tz with other timezones too
check_rust_primitive_array_roundtrip(
TimestampNanosecondArray::from(vec![1000, 2000, 3000]).with_timezone("UTC"),
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone("UTC"),
TimestampNanosecondArray::from(vec![1000, 2000, 3000]).with_timezone_utc(),
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone_utc(),
)?;

check_rust_primitive_array_roundtrip(
TimestampMillisecondArray::from(vec![1, 2, 3]).with_timezone("UTC"),
TimestampMicrosecondArray::from(vec![1000, 2000, 3000]).with_timezone("UTC"),
TimestampMillisecondArray::from(vec![1, 2, 3]).with_timezone_utc(),
TimestampMicrosecondArray::from(vec![1000, 2000, 3000]).with_timezone_utc(),
)?;

check_rust_primitive_array_roundtrip(
TimestampSecondArray::from(vec![1, 2, 3]).with_timezone("UTC"),
TimestampMicrosecondArray::from(vec![1_000_000, 2_000_000, 3_000_000]).with_timezone("UTC"),
TimestampSecondArray::from(vec![1, 2, 3]).with_timezone_utc(),
TimestampMicrosecondArray::from(vec![1_000_000, 2_000_000, 3_000_000]).with_timezone_utc(),
)?;

check_rust_primitive_array_roundtrip(
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone("UTC"),
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone("UTC"),
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone_utc(),
TimestampMicrosecondArray::from(vec![1, 2, 3]).with_timezone_utc(),
)?;

check_rust_primitive_array_roundtrip(Date32Array::from(vec![1, 2, 3]), Date32Array::from(vec![1, 2, 3]))?;
Expand Down

0 comments on commit da3b672

Please sign in to comment.