Skip to content

Commit fea073a

Browse files
committed
allow arrow timestamptz with UTC to be read as iceberg timestamp
1 parent e759044 commit fea073a

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
@@ -1844,11 +1844,11 @@ def _cast_if_needed(self, field: NestedField, values: pa.Array) -> pa.Array:
18441844
pa.types.is_timestamp(target_type)
18451845
and not target_type.tz
18461846
and pa.types.is_timestamp(values.type)
1847-
and not values.type.tz
1847+
and (values.type.tz in UTC_ALIASES or values.type.tz is None)
18481848
):
18491849
if target_type.unit == "us" and values.type.unit == "ns" and self._downcast_ns_timestamp_to_us:
18501850
return values.cast(target_type, safe=False)
1851-
elif target_type.unit == "us" and values.type.unit in {"s", "ms"}:
1851+
elif target_type.unit == "us" and values.type.unit in {"s", "ms", "us"}:
18521852
return values.cast(target_type)
18531853
raise ValueError(f"Unsupported schema projection from {values.type} to {target_type}")
18541854
elif field.field_type == TimestamptzType():

0 commit comments

Comments
 (0)