From d190b147a26870ec4642628f3075907a5656170a Mon Sep 17 00:00:00 2001 From: ion-elgreco Date: Sat, 5 Aug 2023 11:51:45 +0200 Subject: [PATCH] Formatting --- py-polars/polars/dataframe/frame.py | 9 +++++---- py-polars/polars/io/delta.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index c6491c98129eb..7451a9efdb04c 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -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 `__. See list below. + are casted to their respective `primitive types + `__. + See list below: - `uint` -> `int` - `timestamp(ns)` -> `timestamp(us)` - `timestamp(ms)` -> `timestamp(us)` @@ -3383,7 +3385,6 @@ def write_delta( _check_if_delta_available() from deltalake.writer import ( - try_get_deltatable, write_deltalake, ) @@ -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, diff --git a/py-polars/polars/io/delta.py b/py-polars/polars/io/delta.py index 8afd7a9b02e12..123006dc2a5ac 100644 --- a/py-polars/polars/io/delta.py +++ b/py-polars/polars/io/delta.py @@ -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):