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

ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 70ce0cfd0d01 [SPARK-53695][PYTHON][TESTS][FOLLOW-UP] Additional test 
for type hint
70ce0cfd0d01 is described below

commit 70ce0cfd0d018e4b5f5fe76cb14b2290754afc03
Author: Ruifeng Zheng <ruife...@apache.org>
AuthorDate: Thu Sep 25 17:28:26 2025 +0800

    [SPARK-53695][PYTHON][TESTS][FOLLOW-UP] Additional test for type hint
    
    ### What changes were proposed in this pull request?
    follow up of https://github.com/apache/spark/pull/52437
    
    ### Why are the changes needed?
    check the eval type inference of 0-arg grouped agg UDF
    
    ### Does this PR introduce _any_ user-facing change?
    no, test-only
    
    ### How was this patch tested?
    ci
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #52452 from zhengruifeng/type_hint_test_0_arg.
    
    Authored-by: Ruifeng Zheng <ruife...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 python/pyspark/sql/tests/arrow/test_arrow_udf_typehints.py        | 8 ++++++++
 python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py      | 8 ++++++++
 .../pandas/test_pandas_udf_typehints_with_future_annotations.py   | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/python/pyspark/sql/tests/arrow/test_arrow_udf_typehints.py 
b/python/pyspark/sql/tests/arrow/test_arrow_udf_typehints.py
index 81d980cc3721..e61fdb81c028 100644
--- a/python/pyspark/sql/tests/arrow/test_arrow_udf_typehints.py
+++ b/python/pyspark/sql/tests/arrow/test_arrow_udf_typehints.py
@@ -164,6 +164,14 @@ class ArrowUDFTypeHintsTests(ReusedSQLTestCase):
             infer_eval_type(signature(func), get_type_hints(func)), 
ArrowUDFType.GROUPED_AGG
         )
 
+        def func() -> float:
+            pass
+
+        self.assertEqual(
+            infer_eval_type(signature(func), get_type_hints(func), "arrow"),
+            ArrowUDFType.GROUPED_AGG,
+        )
+
     def test_type_annotation_negative(self):
         def func(col: str) -> pa.Array:
             pass
diff --git a/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py 
b/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py
index bb00f8f5b69b..a436b71c123d 100644
--- a/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py
+++ b/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py
@@ -178,6 +178,14 @@ class PandasUDFTypeHintsTests(ReusedSQLTestCase):
             infer_eval_type(signature(func), get_type_hints(func)), 
PandasUDFType.GROUPED_AGG
         )
 
+        def func() -> float:
+            pass
+
+        self.assertEqual(
+            infer_eval_type(signature(func), get_type_hints(func), "pandas"),
+            PandasUDFType.GROUPED_AGG,
+        )
+
     def test_type_annotation_negative(self):
         def func(col: str) -> pd.Series:
             pass
diff --git 
a/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py
 
b/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py
index 442e1c61a0ba..9fa3531ee137 100644
--- 
a/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py
+++ 
b/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py
@@ -158,6 +158,14 @@ class 
PandasUDFTypeHintsWithFutureAnnotationsTests(ReusedSQLTestCase):
             infer_eval_type(signature(func), get_type_hints(func)), 
PandasUDFType.GROUPED_AGG
         )
 
+        def func() -> float:
+            pass
+
+        self.assertEqual(
+            infer_eval_type(signature(func), get_type_hints(func), "pandas"),
+            PandasUDFType.GROUPED_AGG,
+        )
+
     def test_type_annotation_negative(self):
         def func(col: str) -> pd.Series:
             pass


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to