pola-rs/polars · error · ValueError

Unexpected symbol: {a}

Error message

Unexpected symbol: {a}

What it means

Error "Unexpected symbol: {a}" thrown in pola-rs/polars.

Source

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

    We need this to convert it into a PyIceberg expression.

    Parameters
    ----------
    expr
        The string expression

    Returns
    -------
    The AST representing the Arrow expression
    """
    return ast.parse(expr, mode="eval").body


@singledispatch
def _convert_predicate(a: Any) -> Any:
    """Walks the AST to convert the PyArrow expression to a PyIceberg expression."""
    msg = f"Unexpected symbol: {a}"
    raise ValueError(msg)


@_convert_predicate.register(Constant)
def _(a: Constant) -> Any:
    return a.value


@_convert_predicate.register(Name)
def _(a: Name) -> Any:
    return a.id


@_convert_predicate.register(UnaryOp)
def _(a: UnaryOp) -> Any:
    if isinstance(a.op, Invert):
        operand = _ensure_boolean_expression(_convert_predicate(a.operand))
        return pyiceberg.expressions.Not(operand)
    else:

View on GitHub (pinned to df599052da)

When it happens

Trigger: Thrown at py-polars/src/polars/io/iceberg/_utils.py:175 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/35616084c634f524. Report an issue: GitHub.