From 6434a2731b9dbb03dd65663733ed91987a07ea55 Mon Sep 17 00:00:00 2001 From: Omkar P <45419097+omkar-foss@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:09:20 +0530 Subject: [PATCH] add failing test --- python/tests/test_writer.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/python/tests/test_writer.py b/python/tests/test_writer.py index 11320743e0..b7a6977c54 100644 --- a/python/tests/test_writer.py +++ b/python/tests/test_writer.py @@ -2031,3 +2031,33 @@ def test_write_structs(tmp_path: pathlib.Path): arrow_dt = dt.to_pyarrow_dataset() new_df = pl.scan_pyarrow_dataset(arrow_dt) new_df.collect() + + +@pytest.mark.polars +def test_write_binary_col(tmp_path: pathlib.Path): + import polars as pl + + data_with_bin_col = {"bin_col": [b"12345", b"67890"], "id": [1, 2]} + + df_with_bin_col = pl.DataFrame(data_with_bin_col) + df_with_bin_col.write_delta(tmp_path) + + assert len(df_with_bin_col.rows()) == 2 + + +# +@pytest.mark.polars +def test_write_binary_col_with_dssc(tmp_path: pathlib.Path): + import polars as pl + + data_with_bin_col = {"bin_col": [b"12345", b"67890"], "id": [1, 2]} + + df_with_bin_col = pl.DataFrame(data_with_bin_col) + df_with_bin_col.write_delta( + tmp_path, + delta_write_options={ + "configuration": {"delta.dataSkippingStatsColumns": "bin_col"}, + }, + ) + + assert len(df_with_bin_col.rows()) == 2