Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17831#discussion_r114515726
  
    --- Diff: python/pyspark/sql/catalog.py ---
    @@ -237,23 +237,28 @@ def registerFunction(self, name, f, 
returnType=StringType()):
             :param name: name of the UDF
             :param f: python function
             :param returnType: a :class:`pyspark.sql.types.DataType` object
    +        :return: a wrapped :class:`UserDefinedFunction`
     
    -        >>> spark.catalog.registerFunction("stringLengthString", lambda x: 
len(x))
    +        >>> strlen = spark.catalog.registerFunction("stringLengthString", 
len)
             >>> spark.sql("SELECT stringLengthString('test')").collect()
             [Row(stringLengthString(test)=u'4')]
     
    +        >>> spark.sql("SELECT 'foo' AS 
text").select(strlen("text")).collect()
    +        [Row(stringLengthString(text)=u'3')]
    +
             >>> from pyspark.sql.types import IntegerType
    -        >>> spark.catalog.registerFunction("stringLengthInt", lambda x: 
len(x), IntegerType())
    +        >>> strlen = spark.catalog.registerFunction("stringLengthInt", 
len, IntegerType())
    --- End diff --
    
    Hm, I think capturing is rather better because it is what this API returns 
(and as it dose not return `None` anymore) if we don't have a better idea. 
Variable that indicates it's private, `_`, looks also fine to me.  No strong 
opinion. I am fine if we don't have a simpler and cleaner idea.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to