From baf5cbba57230ffe0c3261a5bc5ed56bcd281e12 Mon Sep 17 00:00:00 2001 From: BharatDeva <278575558+BharatDeva@users.noreply.github.com> Date: Fri, 8 May 2026 19:28:51 -0500 Subject: [PATCH] fix: type scalar UDF returns as Arrow arrays --- python/datafusion/user_defined.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/datafusion/user_defined.py b/python/datafusion/user_defined.py index 848ab4cee..9a693e516 100644 --- a/python/datafusion/user_defined.py +++ b/python/datafusion/user_defined.py @@ -33,7 +33,7 @@ if TYPE_CHECKING: from _typeshed import CapsuleType as _PyCapsule - _R = TypeVar("_R", bound=pa.DataType) + _R = TypeVar("_R", bound=pa.Array) from collections.abc import Callable, Sequence @@ -125,7 +125,7 @@ def __init__( name: str, func: Callable[..., _R], input_fields: list[pa.Field], - return_field: _R, + return_field: pa.Field, volatility: Volatility | str, ) -> None: """Instantiate a scalar user-defined function (UDF). @@ -264,7 +264,7 @@ def _function( def _decorator( input_fields: Sequence[pa.DataType | pa.Field] | pa.DataType | pa.Field, - return_field: _R, + return_field: pa.DataType | pa.Field, volatility: Volatility | str, name: str | None = None, ) -> Callable: