Skip to content

Commit 528da88

Browse files
committed
allow arrow timestamptz with UTC to be read as iceberg timestamp
1 parent a02c0bf commit 528da88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,11 +1901,11 @@ def _cast_if_needed(self, field: NestedField, values: pa.Array) -> pa.Array:
19011901
pa.types.is_timestamp(target_type)
19021902
and not target_type.tz
19031903
and pa.types.is_timestamp(values.type)
1904-
and not values.type.tz
1904+
and (values.type.tz in UTC_ALIASES or values.type.tz is None)
19051905
):
19061906
if target_type.unit == "us" and values.type.unit == "ns" and self._downcast_ns_timestamp_to_us:
19071907
return values.cast(target_type, safe=False)
1908-
elif target_type.unit == "us" and values.type.unit in {"s", "ms"}:
1908+
elif target_type.unit == "us" and values.type.unit in {"s", "ms", "us"}:
19091909
return values.cast(target_type)
19101910
raise ValueError(f"Unsupported schema projection from {values.type} to {target_type}")
19111911
elif field.field_type == TimestamptzType():

0 commit comments

Comments
 (0)