From 615c3a5d5af3d6f8a34ec7432cc3af396e601a1b Mon Sep 17 00:00:00 2001 From: Omkar P <45419097+omkar-foss@users.noreply.github.com> Date: Tue, 21 Jan 2025 20:52:07 +0530 Subject: [PATCH] add failing test Signed-off-by: Omkar P <45419097+omkar-foss@users.noreply.github.com> --- python/tests/test_writer.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/python/tests/test_writer.py b/python/tests/test_writer.py index cbf40dbfd1..7e4e2b080c 100644 --- a/python/tests/test_writer.py +++ b/python/tests/test_writer.py @@ -2046,3 +2046,32 @@ def test_write_type_coercion_predicate(tmp_path: pathlib.Path): mode="overwrite", delta_write_options=dict(engine="rust", predicate="C = 'a'"), ) + +@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