This is an automated email from the ASF dual-hosted git repository.

kosiew pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 7eaef922 fix: tighten scalar UDF return type hints (#1642)
7eaef922 is described below

commit 7eaef922de85e62ae9c5624a18c60f529fee9429
Author: BharatDeva <[email protected]>
AuthorDate: Mon Aug 3 03:30:57 2026 -0500

    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
---
 python/datafusion/user_defined.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/datafusion/user_defined.py 
b/python/datafusion/user_defined.py
index 81a516af..394c682a 100644
--- a/python/datafusion/user_defined.py
+++ b/python/datafusion/user_defined.py
@@ -249,7 +249,8 @@ class ScalarUDF:
             input_fields (list[pa.Field | pa.DataType]): The data types or 
Fields
                 of the arguments to ``func``. This list must be of the same 
length
                 as the number of arguments.
-            return_field (_R): The field of the return value from the function.
+            return_field (pa.DataType | pa.Field): The field of the return 
value
+                from the function.
             volatility (Volatility | str): See `Volatility` for allowed values.
             name (Optional[str]): A descriptive name for the function.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to