Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Aug 5, 2023
1 parent f52e725 commit d190b14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3298,7 +3298,9 @@ def write_delta(
Note: Some polars data types like `Null`, `Categorical` and `Time` are
not supported by the delta protocol specification. Other unsupported datatypes
are casted to their respective `primitive types <https://github.com/delta-io/delta/blob/master/PROTOCOL.md#primitive-types>`__. See list below.
are casted to their respective `primitive types
<https://github.com/delta-io/delta/blob/master/PROTOCOL.md#primitive-types>`__.
See list below:
- `uint` -> `int`
- `timestamp(ns)` -> `timestamp(us)`
- `timestamp(ms)` -> `timestamp(us)`
Expand Down Expand Up @@ -3383,7 +3385,6 @@ def write_delta(
_check_if_delta_available()

from deltalake.writer import (
try_get_deltatable,
write_deltalake,
)

Expand Down Expand Up @@ -3416,9 +3417,9 @@ def check_unsupported_types(n: str, t: PolarsDataType | None) -> None:
data = self.to_arrow()
data_schema = data.schema
delta_schema = _create_delta_compatible_schema(data_schema)

#! This will raise ArrowInvalidError if user has to big uints to cast in int
data = data.cast(delta_schema)
data = data.cast(delta_schema)

write_deltalake(
table_or_uri=target,
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/io/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def _reconstruct_field_type(
pa.uint32(): pa.int32(),
pa.uint64(): pa.int64(),
pa.large_string(): pa.string(),
pa.large_binary(): pa.binary()
pa.large_binary(): pa.binary(),
}

if isinstance(field.type, pa.TimestampType):
Expand Down

0 comments on commit d190b14

Please sign in to comment.