Skip to content

ibis-polars backend missing WindowFunction translation — blocks with_row_index #78

Description

@discreteds

Summary

On the ibis-polars backend, Relation.with_row_index(...) raises ibis.common.exceptions.OperationNotDefinedError: No translation rule for <class 'ibis.expr.operations.window.WindowFunction'>. The ibis polars backend has no window-function translator, so any relation operation that compiles to a WindowFunction node is unusable on that backend.

Reproduction

import polars as pl
import ibis
from mountainash.relations import relation

conn = ibis.polars.connect()
tbl = conn.create_table("t", pl.DataFrame({"x": [3, 1, 2]}), overwrite=True)
rel = relation(tbl).with_row_index(name="__rank")
rel.collect()
# ibis.common.exceptions.OperationNotDefinedError:
# No translation rule for <class 'ibis.expr.operations.window.WindowFunction'>

Other ibis backends (ibis-duckdb, ibis-sqlite) handle the same operation fine — this is specific to ibis-polars.

Impact

Blocks cross-backend parameterisation of mountainash-utils-rules tests on ibis-polars. The rules engine uses with_row_index to assign __rank after sorting by specificity. Currently tracked via non-strict xfail in mountainash-utils-rules/tests/conftest.py::UPSTREAM_BROKEN_BACKENDS.

Possible paths

  1. Upstream ibis adds a polars backend translator for WindowFunction.
  2. Mountainash's narwhals/ibis-polars code path detects the limitation and falls back to a non-window row-number implementation (e.g. compute via materialized sort + enumerate).
  3. Mountainash documents ibis-polars as not supporting window operations and drops it from the default backend matrix for window-using relations.

Leaning toward option 1 as the right long-term fix — window functions are a core SQL feature and the ibis-polars gap is clearly a missing translator, not a design decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions