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

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


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new de31a0f5fee [SPARK-42428][CONNECT][PYTHON] Standardize __repr__ of 
CommonInlineUserDefinedFunction
de31a0f5fee is described below

commit de31a0f5fee6fdde044fe0584c964833f3556221
Author: Xinrong Meng <xinr...@apache.org>
AuthorDate: Tue Feb 14 17:05:13 2023 +0800

    [SPARK-42428][CONNECT][PYTHON] Standardize __repr__ of 
CommonInlineUserDefinedFunction
    
    ### What changes were proposed in this pull request?
    Standardize __repr__ of CommonInlineUserDefinedFunction.
    
    ### Why are the changes needed?
    To reach parity with vanilla PySpark.
    
    ### Does this PR introduce _any_ user-facing change?
    The column representation reaches parity with the vanilla PySpark's now, as 
shown below.
    
    Before
    ```
    >>> udf(lambda x : x + 1)(df.id)
    Column<'<lambda>(id), True, "string", 100, 
b'\x80\x05\x95\xe1\x01\x00\x00\x00\x00\x00\x00\x8c\x1fpyspark.cloudpickle.cloudpickle\x94\x8c\x0e_make_function\x94\x93\x94(h\x00\x8c\r_builtin_type\x94\x93\x94\x8c\x08CodeType\x94\x85\x94R\x94(K\x01K\x00K\x00K\x01K\x02KCC\x08|\x00d\x01\x17\x00S\x00\x94NK\x01\x86\x94)\x8c\x01x\x94\x85\x94\x8c\x07<stdin>\x94\x8c\x08<lambda>\x94K\x01C\x00\x94))t\x94R\x94}\x94(\x8c\x0b__package__\x94N\x8c\x08__name__\x94\x8c\x08__main__\x94uNNNt\x94R\x94\x8c$pys
 [...]
    ```
    
    Now
    ```
    >>> udf(lambda x : x + 1)(df.id)
    Column<'<lambda>(id)'>
    ```
    
    ### How was this patch tested?
    Existing tests.
    
    Closes #40003 from xinrong-meng/udf_repr.
    
    Authored-by: Xinrong Meng <xinr...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
    (cherry picked from commit 676332a1f4d6a522f009fa91e593904588cfe9f2)
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 python/pyspark/sql/connect/expressions.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/python/pyspark/sql/connect/expressions.py 
b/python/pyspark/sql/connect/expressions.py
index 571dd2b2f4b..6e34719042d 100644
--- a/python/pyspark/sql/connect/expressions.py
+++ b/python/pyspark/sql/connect/expressions.py
@@ -555,10 +555,7 @@ class CommonInlineUserDefinedFunction(Expression):
         return expr
 
     def __repr__(self) -> str:
-        return (
-            f"{self._function_name}({', '.join([str(arg) for arg in 
self._arguments])}), "
-            f"{self._deterministic}, {self._function}"
-        )
+        return f"{self._function_name}({', '.join([str(arg) for arg in 
self._arguments])})"
 
 
 class WithField(Expression):


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

Reply via email to