From 42c193da3c448b99f9158b09effb1580966f31d8 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Thu, 1 Oct 2026 12:04:32 -0400 Subject: [PATCH 1/3] fix(python): support unsigned Polars scalar literals Signed-off-by: Daniel King --- vortex-python/python/vortex/polars_.py | 2 ++ vortex-python/test/test_polars_.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/vortex-python/python/vortex/polars_.py b/vortex-python/python/vortex/polars_.py index 03040371a3c..a8b3102761b 100644 --- a/vortex-python/python/vortex/polars_.py +++ b/vortex-python/python/vortex/polars_.py @@ -104,6 +104,8 @@ def _polars_to_vortex(expr: dict[str, Any]) -> ve.Expr: elif "Decimal" in scalar: value, precision, scale = scalar["Decimal"] return ve.literal(_dtype.decimal(precision=precision, scale=scale), value) + elif len(scalar) == 1 and next(iter(scalar)) in _LITERAL_TYPES: + dtype, value = next(iter(scalar.items())) else: raise ValueError(f"Cannot convert to Vortex: unsupported Polars scalar value type {scalar}") diff --git a/vortex-python/test/test_polars_.py b/vortex-python/test/test_polars_.py index 554087ae93b..cc08858b030 100644 --- a/vortex-python/test/test_polars_.py +++ b/vortex-python/test/test_polars_.py @@ -129,3 +129,20 @@ def test_polars_is_between(tmp_path, closed, expected): actual = vx.open(str(path)).to_polars().filter(expr).collect() assert_frame_equal(actual, expected_frame) assert actual["id"].to_list() == expected + + +@pytest.mark.parametrize( + "arrow_type, threshold", + [(pa.uint8(), 50), (pa.uint16(), 500), (pa.uint32(), 500), (pa.uint64(), 500)], +) +def test_unsigned_predicate_pushdown(tmp_path, arrow_type, threshold): + table = pa.table( + { + "id": [0, 1, 2], + "value": pa.array([threshold - 1, threshold, threshold + 1], type=arrow_type), + } + ) + path = tmp_path / "unsigned.vortex" + vx.io.write(vx.array(table), str(path)) + result = vx.open(str(path)).to_polars().filter(pl.col("value") >= threshold).collect() + assert result["id"].to_list() == [1, 2] From 4dd35d0db203efe02134451ef8d0f38ee1abdea0 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Thu, 1 Oct 2026 13:26:11 -0400 Subject: [PATCH 2/3] test(python): compare Polars and Vortex file-scan results Signed-off-by: Daniel King --- vortex-python/test/test_polars_.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vortex-python/test/test_polars_.py b/vortex-python/test/test_polars_.py index cc08858b030..b845d2baf5e 100644 --- a/vortex-python/test/test_polars_.py +++ b/vortex-python/test/test_polars_.py @@ -144,5 +144,8 @@ def test_unsigned_predicate_pushdown(tmp_path, arrow_type, threshold): ) path = tmp_path / "unsigned.vortex" vx.io.write(vx.array(table), str(path)) - result = vx.open(str(path)).to_polars().filter(pl.col("value") >= threshold).collect() + expr = pl.col("value") >= threshold + expected = pl.from_arrow(table).lazy().filter(expr).collect() + result = vx.open(str(path)).to_polars().filter(expr).collect() + assert_frame_equal(result, expected) assert result["id"].to_list() == [1, 2] From 092e50d99dd5577717aa20d33fec48019f9ad9fc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 22:13:58 +0000 Subject: [PATCH 3/3] fix(python): satisfy ty after rebase Signed-off-by: Claude Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01E92wUoS3LaqWVJmmS7vKVq --- vortex-python/test/test_polars_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vortex-python/test/test_polars_.py b/vortex-python/test/test_polars_.py index b845d2baf5e..759ea605eb7 100644 --- a/vortex-python/test/test_polars_.py +++ b/vortex-python/test/test_polars_.py @@ -145,7 +145,7 @@ def test_unsigned_predicate_pushdown(tmp_path, arrow_type, threshold): path = tmp_path / "unsigned.vortex" vx.io.write(vx.array(table), str(path)) expr = pl.col("value") >= threshold - expected = pl.from_arrow(table).lazy().filter(expr).collect() + expected = pl.DataFrame(table).lazy().filter(expr).collect() result = vx.open(str(path)).to_polars().filter(expr).collect() assert_frame_equal(result, expected) assert result["id"].to_list() == [1, 2]