You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/01/22 12:20:32 UTC

[spark] branch branch-3.1 updated: [SPARK-34191][PYTHON][SQL] Add typing for udf overload

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

gurwls223 pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 2e9be48  [SPARK-34191][PYTHON][SQL] Add typing for udf overload
2e9be48 is described below

commit 2e9be48661d0adb1bf77ea5f18decfb57d50d096
Author: pgrz <gr...@gmail.com>
AuthorDate: Fri Jan 22 21:19:20 2021 +0900

    [SPARK-34191][PYTHON][SQL] Add typing for udf overload
    
    ### What changes were proposed in this pull request?
    Added typing for keyword-only single argument udf overload.
    
    ### Why are the changes needed?
    
    The intended use case is:
    ```
    udf(returnType="string")
    def f(x): ...
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes - a new typing for udf is considered valid.
    
    ### How was this patch tested?
    
    Existing tests.
    
    Closes #31282 from pgrz/patch-1.
    
    Authored-by: pgrz <gr...@gmail.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
    (cherry picked from commit 121eb0130eaaa3ed13b366bda236ce499fbc6b4e)
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 python/pyspark/sql/functions.pyi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/python/pyspark/sql/functions.pyi b/python/pyspark/sql/functions.pyi
index 8df5534..f1043a0 100644
--- a/python/pyspark/sql/functions.pyi
+++ b/python/pyspark/sql/functions.pyi
@@ -351,3 +351,8 @@ def udf(
 def udf(
     f: DataTypeOrString = ...,
 ) -> Callable[[Callable[..., Any]], Callable[..., Column]]: ...
+@overload
+def udf(
+    *,
+    returnType: DataTypeOrString = ...,
+) -> Callable[[Callable[..., Any]], Callable[..., Column]]: ...


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