From 4038298d41bce5654ee5208b14c97c6e4401d604 Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Sun, 11 Dec 2022 20:16:33 +0100 Subject: [PATCH 1/2] fix(rust): fix nested writer --- Cargo.toml | 4 ++-- py-polars/Cargo.lock | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0e795884d939..8f261325c5db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,8 +35,8 @@ package = "arrow2" # git = "https://github.com/jorgecarleitao/arrow2" git = "https://github.com/ritchie46/arrow2" # rev = "368aacc173a27e2a763d2c6396682a688e5a2707" -# path = "../../../arrow2" -branch = "polars_2022-12-10" +# path = "../arrow2" +branch = "polars_2022-12-11" version = "0.14.1" default-features = false features = [ diff --git a/py-polars/Cargo.lock b/py-polars/Cargo.lock index a4366c30a4e5..19742feafc80 100644 --- a/py-polars/Cargo.lock +++ b/py-polars/Cargo.lock @@ -96,7 +96,6 @@ dependencies = [ [[package]] name = "arrow2" version = "0.14.2" -source = "git+https://github.com/ritchie46/arrow2?branch=polars_2022-12-10#09c32382fc54e427929228fa551ab6e46578fb22" dependencies = [ "ahash 0.8.1", "arrow-format", From 52b61149f0b9c2e5e44f22fea4a8e48e43555c3b Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Sun, 11 Dec 2022 21:22:16 +0100 Subject: [PATCH 2/2] add test --- py-polars/Cargo.lock | 1 + py-polars/tests/unit/io/test_parquet.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/py-polars/Cargo.lock b/py-polars/Cargo.lock index 19742feafc80..3c31cebfd3ee 100644 --- a/py-polars/Cargo.lock +++ b/py-polars/Cargo.lock @@ -96,6 +96,7 @@ dependencies = [ [[package]] name = "arrow2" version = "0.14.2" +source = "git+https://github.com/ritchie46/arrow2?branch=polars_2022-12-11#80359ce87a1d15d3ce999f4290a101c5723af113" dependencies = [ "ahash 0.8.1", "arrow-format", diff --git a/py-polars/tests/unit/io/test_parquet.py b/py-polars/tests/unit/io/test_parquet.py index a6157bd45eac..fd9ee6efaf01 100644 --- a/py-polars/tests/unit/io/test_parquet.py +++ b/py-polars/tests/unit/io/test_parquet.py @@ -250,3 +250,17 @@ def test_row_group_size_saturation() -> None: df.write_parquet(f, row_group_size=1024) f.seek(0) assert pl.read_parquet(f).frame_equal(df) + + +def test_nested_sliced() -> None: + for df in [ + pl.Series([[1, 2], [3, 4], [5, 6]]).slice(2, 2).to_frame(), + pl.Series([[None, 2], [3, 4], [5, 6]]).to_frame(), + pl.Series([[None, 2], [3, 4], [5, 6]]).slice(2, 2).to_frame(), + pl.Series([["a", "a"], ["", "a"], ["c", "de"]]).slice(3, 2).to_frame(), + pl.Series([[None, True], [False, False], [True, True]]).slice(2, 2).to_frame(), + ]: + f = io.BytesIO() + df.write_parquet(f) + f.seek(0) + assert pl.read_parquet(f).frame_equal(df)