Skip to content

Commit

Permalink
Disable TZ for now, will have to check with delta-rs team why TZ gets…
Browse files Browse the repository at this point in the history
… casted into no TZ
  • Loading branch information
ion-elgreco committed Jul 29, 2023
1 parent 00938b4 commit 5081171
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions py-polars/polars/io/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,14 @@ def _reconstruct_field_type(
if reconstructed_field is None:
return pa.field(
name=field.name,
type=pa.timestamp("us", tz=field.type.tz),
type=pa.timestamp("us"
# , tz=field.type.tz
),
)
else:
reconstructed_field.append(pa.timestamp("us", tz=field.type.tz))
reconstructed_field.append(pa.timestamp("us",
# tz=field.type.tz
))
return pa.field(
name=field_head.name,
type=reduce(lambda x, y: y(x), reversed(reconstructed_field)),
Expand Down Expand Up @@ -395,10 +399,7 @@ def _create_delta_compatible_schema(schema: pa.schema) -> pa.Schema:
Returns:
pa.Schema: delta compatible schema
"""
if any(dtype in str(schema.types) for dtype in ['uint', 'timestamp[ms]', 'timestamp[ns]']):
schema_out = [*map(_reconstruct_field_type, schema, schema)]
else:
schema_out = schema
schema_out = [*map(_reconstruct_field_type, schema, schema)]
schema = pa.schema(schema_out, metadata=schema.metadata)

return schema

0 comments on commit 5081171

Please sign in to comment.