Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions python/cudf_polars/cudf_polars/streaming/explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,11 @@ def _predicate_to_str(expr: Expr) -> str:
sym = _BINOP_SYMBOLS.get(op, op.name)
return f"({_predicate_to_str(left)} {sym} {_predicate_to_str(right)})"
case UnaryFunction(name=name):
(child,) = expr.children
return f"{name}({_predicate_to_str(child)})"
# Unlike the other cases here, UnaryFunction doesn't have a fixed
# number of children. E.g. `pl.col("x").fill_null(0)` has two:
# the column expression ("x") and the fill value literal (0).
args = ", ".join(_predicate_to_str(child) for child in expr.children)
return f"{name}({args})"
case Ternary():
when, then, otherwise = expr.children
return f"when({_predicate_to_str(when)}).then({_predicate_to_str(then)}).otherwise({_predicate_to_str(otherwise)})"
Expand Down
Loading