Skip to content

Commit 5657d21

Browse files
authored
feat(polars): add ArrayDistinct operation (#10334)
1 parent 80ad348 commit 5657d21

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ibis/backends/polars/compiler.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,3 +1539,9 @@ def visit_ArrayUnion(op, **kw):
15391539
left = translate(op.left, **kw)
15401540
right = translate(op.right, **kw)
15411541
return left.list.set_union(right)
1542+
1543+
1544+
@translate.register(ops.ArrayDistinct)
1545+
def visit_ArrayDistinct(op, **kw):
1546+
arg = translate(op.arg, **kw)
1547+
return arg.list.unique()

ibis/backends/tests/test_array.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def test_array_remove(con, input, expected):
749749

750750

751751
@builtin_array
752-
@pytest.mark.notimpl(["datafusion", "polars"], raises=com.OperationNotDefinedError)
752+
@pytest.mark.notimpl(["datafusion"], raises=com.OperationNotDefinedError)
753753
@pytest.mark.notimpl(
754754
["sqlite"], raises=com.UnsupportedBackendType, reason="Unsupported type: Array..."
755755
)
@@ -779,6 +779,11 @@ def test_array_remove(con, input, expected):
779779
[{3, 1}, set(), {42}, set(), {None}, None],
780780
id="null",
781781
marks=[
782+
pytest.mark.notyet(
783+
["polars"],
784+
raises=AssertionError,
785+
reason="Null elements are transformed to NaN",
786+
),
782787
pytest.mark.notyet(
783788
["pyspark"],
784789
condition=IS_SPARK_REMOTE,

0 commit comments

Comments
 (0)