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 2020/11/01 10:12:07 UTC

[spark] branch master updated: [SPARK-33310][PYTHON] Relax pyspark typing for sql str functions

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

gurwls223 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 56587f0  [SPARK-33310][PYTHON] Relax pyspark typing for sql str functions
56587f0 is described below

commit 56587f076d282ec96c4779faa63d7d9764cf0c3c
Author: Daniel Himmelstein <da...@gmail.com>
AuthorDate: Sun Nov 1 19:09:12 2020 +0900

    [SPARK-33310][PYTHON] Relax pyspark typing for sql str functions
    
    ### What changes were proposed in this pull request?
    
    Relax pyspark typing for sql str functions. These functions all pass the first argument through `_to_java_column`, such that a string or Column object is acceptable.
    
    ### Why are the changes needed?
    
    Convenience & ensuring the typing reflects the functionality
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, a backwards-compatible increase in functionality. But I think typing support is unreleased, so possibly no change to released versions.
    
    ### How was this patch tested?
    
    Not tested. I am newish to Python typing with stubs, so someone should confirm this is the correct way to fix this.
    
    Closes #30209 from dhimmel/patch-1.
    
    Authored-by: Daniel Himmelstein <da...@gmail.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 python/pyspark/sql/functions.pyi | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/python/pyspark/sql/functions.pyi b/python/pyspark/sql/functions.pyi
index 1d048ef..7ba3f07 100644
--- a/python/pyspark/sql/functions.pyi
+++ b/python/pyspark/sql/functions.pyi
@@ -155,11 +155,11 @@ def overlay(
 def substring(str: ColumnOrName, pos: int, len: int) -> Column: ...
 def substring_index(str: ColumnOrName, delim: str, count: int) -> Column: ...
 def levenshtein(left: ColumnOrName, right: ColumnOrName) -> Column: ...
-def locate(substr: str, str: Column, pos: int = ...) -> Column: ...
-def lpad(col: Column, len: int, pad: str) -> Column: ...
-def rpad(col: Column, len: int, pad: str) -> Column: ...
-def repeat(col: Column, n: int) -> Column: ...
-def split(str: Column, pattern: str, limit: int = ...) -> Column: ...
+def locate(substr: str, str: ColumnOrName, pos: int = ...) -> Column: ...
+def lpad(col: ColumnOrName, len: int, pad: str) -> Column: ...
+def rpad(col: ColumnOrName, len: int, pad: str) -> Column: ...
+def repeat(col: ColumnOrName, n: int) -> Column: ...
+def split(str: ColumnOrName, pattern: str, limit: int = ...) -> Column: ...
 def regexp_extract(str: ColumnOrName, pattern: str, idx: int) -> Column: ...
 def regexp_replace(str: ColumnOrName, pattern: str, replacement: str) -> Column: ...
 def initcap(col: ColumnOrName) -> Column: ...


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