From bf1cad5ae56d8e296ee8f35e12072729ef33e91f Mon Sep 17 00:00:00 2001 From: Matthew Murray Date: Tue, 30 Jun 2026 20:51:43 +0000 Subject: [PATCH 1/2] Fix explain() failing on UnaryFunction with multiple children --- python/cudf_polars/cudf_polars/streaming/explain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cudf_polars/cudf_polars/streaming/explain.py b/python/cudf_polars/cudf_polars/streaming/explain.py index 3f6a6dff2869..4f4744709331 100644 --- a/python/cudf_polars/cudf_polars/streaming/explain.py +++ b/python/cudf_polars/cudf_polars/streaming/explain.py @@ -488,8 +488,8 @@ 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)})" + 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)})" From 37745245f4ab2006f5611804802bfc5213ad34a4 Mon Sep 17 00:00:00 2001 From: Matthew Murray Date: Tue, 30 Jun 2026 23:36:05 +0000 Subject: [PATCH 2/2] add comment explaining multiple children for unary functions --- python/cudf_polars/cudf_polars/streaming/explain.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/cudf_polars/cudf_polars/streaming/explain.py b/python/cudf_polars/cudf_polars/streaming/explain.py index 4f4744709331..d0062081d58b 100644 --- a/python/cudf_polars/cudf_polars/streaming/explain.py +++ b/python/cudf_polars/cudf_polars/streaming/explain.py @@ -488,6 +488,9 @@ 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): + # 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():