Skip to content

Commit

Permalink
feat(polars): add polars support for identical_to
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie authored and cpcloud committed Jun 20, 2023
1 parent a2a3e45 commit aab3bae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 7 additions & 0 deletions ibis/backends/polars/compiler.py
Expand Up @@ -328,6 +328,13 @@ def fillna(op, **kw):
return table.select(columns)


@translate.register(ops.IdenticalTo)
def identical_to(op, **kw):
left = translate(op.left, **kw)
right = translate(op.right, **kw)
return left.eq_missing(right)


@translate.register(ops.IfNull)
def ifnull(op, **kw):
arg = translate(op.arg, **kw)
Expand Down
12 changes: 5 additions & 7 deletions ibis/backends/tests/test_generic.py
Expand Up @@ -205,9 +205,7 @@ def test_coalesce(con, expr, expected):


# TODO(dask) - identicalTo - #2553
@pytest.mark.notimpl(
["clickhouse", "datafusion", "polars", "dask", "pyspark", "mssql", "druid"]
)
@pytest.mark.notimpl(["clickhouse", "datafusion", "dask", "pyspark", "mssql", "druid"])
def test_identical_to(backend, alltypes, sorted_df):
sorted_alltypes = alltypes.order_by('id')
df = sorted_df
Expand Down Expand Up @@ -1075,12 +1073,12 @@ def test_pivot_wider(backend):
reason="arbitrary not implemented in the backend",
)
@pytest.mark.notimpl(
["dask", "datafusion", "polars"],
["dask", "datafusion"],
raises=com.OperationNotDefinedError,
reason="backend doesn't implement window functions",
)
@pytest.mark.notimpl(
["pandas"],
["pandas", "polars"],
raises=com.OperationNotDefinedError,
reason="backend doesn't implement ops.WindowFunction",
)
Expand Down Expand Up @@ -1135,12 +1133,12 @@ def test_distinct_on_keep(backend, on, keep):
reason="arbitrary not implemented in the backend",
)
@pytest.mark.notimpl(
["dask", "datafusion", "polars"],
["dask", "datafusion"],
raises=com.OperationNotDefinedError,
reason="backend doesn't implement window functions",
)
@pytest.mark.notimpl(
["pandas"],
["pandas", "polars"],
raises=com.OperationNotDefinedError,
reason="backend doesn't implement ops.WindowFunction",
)
Expand Down

0 comments on commit aab3bae

Please sign in to comment.