Skip to content

Commit 7eaef92

Browse files
authored
fix: tighten scalar UDF return type hints (#1642)
This PR tightens the scalar UDF annotations in python/datafusion/user_defined.py: the callable return type is bounded to pa.Array the scalar UDF constructor accepts return_field: pa.Field the decorator form accepts return_field: pa.DataType | pa.Field
1 parent 3d9583c commit 7eaef92

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

python/datafusion/user_defined.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def udf(*args: Any, **kwargs: Any): # noqa: D417
249249
input_fields (list[pa.Field | pa.DataType]): The data types or Fields
250250
of the arguments to ``func``. This list must be of the same length
251251
as the number of arguments.
252-
return_field (_R): The field of the return value from the function.
252+
return_field (pa.DataType | pa.Field): The field of the return value
253+
from the function.
253254
volatility (Volatility | str): See `Volatility` for allowed values.
254255
name (Optional[str]): A descriptive name for the function.
255256

0 commit comments

Comments
 (0)