From 81d3179fafe0c34752cac09170c1b4ff838e84a6 Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Wed, 16 Oct 2024 06:13:38 -0400 Subject: [PATCH] feat(polars): add ArrayRemove operation (#10322) --- ibis/backends/polars/compiler.py | 7 +++++++ ibis/backends/tests/test_array.py | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ibis/backends/polars/compiler.py b/ibis/backends/polars/compiler.py index 5fb6ce0258ad..22e25ec26c1d 100644 --- a/ibis/backends/polars/compiler.py +++ b/ibis/backends/polars/compiler.py @@ -1521,3 +1521,10 @@ def visit_ArrayContains(op, **kw): arg = translate(op.arg, **kw) value = translate(op.other, **kw) return arg.list.contains(value) + + +@translate.register(ops.ArrayRemove) +def visit_ArrayRemove(op, **kw): + arg = translate(op.arg, **kw) + value = _literal_value(op.other) + return arg.list.set_difference(pl.lit([value])) diff --git a/ibis/backends/tests/test_array.py b/ibis/backends/tests/test_array.py index 2be2cc56866e..fe201eeec6bd 100644 --- a/ibis/backends/tests/test_array.py +++ b/ibis/backends/tests/test_array.py @@ -680,7 +680,6 @@ def test_array_position(con, a, expected_array): @builtin_array -@pytest.mark.notimpl(["polars"], raises=com.OperationNotDefinedError) @pytest.mark.parametrize( ("input", "expected"), [