pola-rs/polars · error · ValueError

Unknown call

Error message

Unknown call: {f!r}

What it means

A Call node in the pyarrow predicate AST is translated only for known function names (e.g. is_null, is_nan). If the walker resolves a call to a function name it does not recognize, it raises ValueError('Unknown call: ...') because there is no pyiceberg equivalent mapping.

Solutions

  1. Restrict filter calls to supported ones: is_null, is_nan (and comparison/boolean operators)
  2. Filter unsupported conditions after loading: use polars `.filter()` on the resulting DataFrame/LazyFrame
  3. Rewrite the condition using supported semantics, e.g. `~pc.field('a').is_null()` instead of `is_valid()`
  4. Check polars' `_convert_predicate` Call mapping for the exact supported set, or upgrade polars

Example fix

// before
pc.field('name').is_valid()  # Unknown call
// after
~pc.field('name').is_null()  # supported
// or filter downstream: df.filter(pl.col('name').is_not_null())
Defensive patterns

Strategy: try-catch

Validate before calling

SUPPORTED_CALLS = {'is_null', 'is_nan'}
def calls_supported(expr) -> bool:
    import ast
    return all(
        (n.func.attr if isinstance(n.func, ast.Attribute) else '') in SUPPORTED_CALLS
        for n in ast.walk(expr) if isinstance(n, ast.Call)
    )

Try / catch

try:
    lf = pl.scan_iceberg(src, filter=pred)
except ValueError as e:
    if 'Unknown call' in str(e):
        lf = pl.scan_iceberg(src).filter(downstream_condition)

Prevention

When it happens

Trigger: Passing a pyarrow.compute filter that calls an unsupported function, e.g. `pc.field('a').is_valid()`, `pc.utf8_is_alphanumeric(...)`, or any compute kernel invocation not in polars' mapping table, when scanning Iceberg with a pyarrow filter.

Common situations: Using rich pyarrow compute kernels inside scan_iceberg filters; typos in supported calls (is_null vs is_valid); version differences where newer pyarrow adds functions polars doesn't map yet.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/cfe17b1813d21ebf. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/io/iceberg/_utils.py:282

    f = _convert_predicate(a.func)
    if f == "field":
        return args
    elif f == "scalar":
        return args[0]
    elif f in _temporal_conversions:
        # convert from polars-native i64 to ISO8601 string
        return _temporal_conversions[f](*args).isoformat()
    else:
        ref = _convert_predicate(a.func.value)[0]  # type: ignore[attr-defined]
        if f == "isin":
            return pyiceberg.expressions.In(ref, args[0])  # type: ignore[misc, call-arg]
        elif f == "is_null":
            return pyiceberg.expressions.IsNull(ref)  # type: ignore[misc]
        elif f == "is_nan":
            return pyiceberg.expressions.IsNaN(ref)  # type: ignore[misc]

    msg = f"Unknown call: {f!r}"
    raise ValueError(msg)


@_convert_predicate.register(Attribute)
def _(a: Attribute) -> Any:
    return a.attr


@_convert_predicate.register(BinOp)
def _(a: BinOp) -> Any:
    lhs = _ensure_boolean_expression(_convert_predicate(a.left))
    rhs = _ensure_boolean_expression(_convert_predicate(a.right))

    op = a.op
    if isinstance(op, BitAnd):
        return pyiceberg.expressions.And(lhs, rhs)
    if isinstance(op, BitOr):
        return pyiceberg.expressions.Or(lhs, rhs)
    else:

View on GitHub (pinned to fe841f959e)