From 6bcdf38ed05115469b7e23d29120aad63cb5bb64 Mon Sep 17 00:00:00 2001 From: Luke Manley Date: Wed, 8 Jan 2025 16:59:03 -0500 Subject: [PATCH] fix: Fix `Int128` dtype serialization --- crates/polars-core/src/datatypes/_serde.rs | 3 +++ py-polars/tests/unit/io/test_pickle.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/polars-core/src/datatypes/_serde.rs b/crates/polars-core/src/datatypes/_serde.rs index 5cc1d7f86c94..3c2a38a34ce8 100644 --- a/crates/polars-core/src/datatypes/_serde.rs +++ b/crates/polars-core/src/datatypes/_serde.rs @@ -85,6 +85,7 @@ enum SerializableDataType { Int16, Int32, Int64, + Int128, Float32, Float64, String, @@ -130,6 +131,7 @@ impl From<&DataType> for SerializableDataType { Int16 => Self::Int16, Int32 => Self::Int32, Int64 => Self::Int64, + Int128 => Self::Int128, Float32 => Self::Float32, Float64 => Self::Float64, String => Self::String, @@ -186,6 +188,7 @@ impl From for DataType { Int16 => Self::Int16, Int32 => Self::Int32, Int64 => Self::Int64, + Int128 => Self::Int128, Float32 => Self::Float32, Float64 => Self::Float64, String => Self::String, diff --git a/py-polars/tests/unit/io/test_pickle.py b/py-polars/tests/unit/io/test_pickle.py index 7f8beb6ca7c6..5b798cbda2eb 100644 --- a/py-polars/tests/unit/io/test_pickle.py +++ b/py-polars/tests/unit/io/test_pickle.py @@ -19,7 +19,12 @@ def test_pickle() -> None: def test_pickle_expr() -> None: - for e in [pl.all(), pl.len(), pl.duration(weeks=10, days=20, hours=3)]: + for e in [ + pl.all(), + pl.len(), + pl.duration(weeks=10, days=20, hours=3), + pl.col("a").cast(pl.Int128), + ]: f = io.BytesIO() pickle.dump(e, f)