diff --git a/ibis/expr/operations/udf.py b/ibis/expr/operations/udf.py index 589e8b8929fa5..461ffe318ac61 100644 --- a/ibis/expr/operations/udf.py +++ b/ibis/expr/operations/udf.py @@ -351,3 +351,35 @@ class agg(_UDF): __slots__ = () _base = AggUDF + + @util.experimental + @classmethod + def builtin(cls, *args: Any, **kwargs: Any) -> Callable: + """Construct an aggregate user-defined function that is built-in to the backend. + + Parameters + ---------- + fn + The The function to wrap. + args + Configuration arguments for the UDF. + name + The name of the UDF in the backend if different from the function name. + schema + The schema in which the builtin function resides. + kwargs + Additional configuration arguments for the UDF. + + Examples + -------- + >>> import ibis + >>> ibis.options.interactive = True + >>> @ibis.udf.agg.builtin + ... def favg(a: float) -> float: + ... '''Compute the average of a column using Kahan summation.''' + >>> t = ibis.examples.penguins.fetch() + >>> expr = favg(t.bill_length_mm) + >>> expr + 43.9219298245614 + """ + return super().builtin(*args, **kwargs)