Skip to content

Commit ab1df94

Browse files
IndexSeekcpcloud
authored andcommitted
feat(polars): add ArrayIndex operation
1 parent 04f8a5f commit ab1df94

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ibis/backends/polars/compiler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,3 +1481,10 @@ def execute_date_delta(op, **kw):
14811481
delta = left - right
14821482
method_name = f"total_{_literal_value(op.part)}s"
14831483
return getattr(delta.dt, method_name)()
1484+
1485+
1486+
@translate.register(ops.ArrayIndex)
1487+
def execute_array_index(op, **kw):
1488+
arg = translate(op.arg, **kw)
1489+
index = translate(op.index, **kw)
1490+
return arg.list.get(index)

ibis/backends/tests/test_array.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ def test_np_array_literal(con):
204204

205205

206206
@pytest.mark.parametrize("idx", range(3))
207-
@pytest.mark.notimpl(["polars"], raises=com.OperationNotDefinedError)
208207
def test_array_index(con, idx):
209208
arr = [1, 2, 3]
210209
expr = ibis.literal(arr)

0 commit comments

Comments
 (0)