User Defined Functions#

The udf() decorator creates user-defined scalar functions for use with the DataFrame API. It supports plain functions, async functions, ScalarFunction subclasses, and callable classes.

Example:

>>> from pyflink.dataframe import udf, DataType
>>> @udf(return_dtype=DataType.string())
... def to_upper(s: str) -> str:
...     return s.upper()

udf()

Create a user-defined function for DataFrame operations.