pola-rs/polars · error · TypeError
Unexpected UnaryOp: {a}
Error message
Unexpected UnaryOp: {a} What it means
Error "Unexpected UnaryOp: {a}" thrown in pola-rs/polars.
Source
Thrown at py-polars/src/polars/io/iceberg/_utils.py:195
@_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:
msg = f"Unexpected UnaryOp: {a}"
raise TypeError(msg)
@_convert_predicate.register(Call)
def _(a: Call) -> Any:
args = [_convert_predicate(arg) for arg in a.args]
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":View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at py-polars/src/polars/io/iceberg/_utils.py:195 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/dff199bca543e490.
Report an issue: GitHub.