Skip to content

Commit 4d5e847

Browse files
authored
feat(polars): add ArrayUnion operation (#10330)
1 parent 9134ef5 commit 4d5e847

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ibis/backends/polars/compiler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,3 +1532,10 @@ def visit_ArrayRemove(op, **kw):
15321532
arg = translate(op.arg, **kw)
15331533
value = _literal_value(op.other)
15341534
return arg.list.set_difference(pl.lit([value]))
1535+
1536+
1537+
@translate.register(ops.ArrayUnion)
1538+
def visit_ArrayUnion(op, **kw):
1539+
left = translate(op.left, **kw)
1540+
right = translate(op.right, **kw)
1541+
return left.list.set_union(right)

ibis/backends/tests/test_array.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ def test_array_sort(con, data):
832832

833833

834834
@builtin_array
835-
@pytest.mark.notimpl(["polars"], raises=com.OperationNotDefinedError)
836835
@pytest.mark.parametrize(
837836
("a", "b", "expected_array"),
838837
[
@@ -853,9 +852,9 @@ def test_array_sort(con, data):
853852
reason="BigQuery doesn't support arrays with null elements",
854853
),
855854
pytest.mark.notyet(
856-
["datafusion"],
855+
["datafusion", "polars"],
857856
raises=AssertionError,
858-
reason="DataFusion transforms null elements to NAN",
857+
reason="Null elements are transformed to NaN",
859858
),
860859
pytest.mark.notyet(
861860
["pyspark"],

0 commit comments

Comments
 (0)