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

    https://github.com/apache/spark/pull/16537#discussion_r124004237
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -1949,6 +1949,14 @@ def _create_judf(self):
             return judf
     
         def __call__(self, *cols):
    +        for c in cols:
    +            if not isinstance(c, (Column, str)):
    --- End diff --
    
    Doesn't this break `unicode` support in Python 2?
    
    ```python
    from pyspark.sql.functions import udf
    udf(lambda x: x)(u"a")
    ```
    
    before
    
    ```
    Column<<lambda>(a)>
    ```
    
    after
    
    ```
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../spark/python/pyspark/sql/functions.py", line 1970, in wrapper
        return self(*args)
      File ".../spark/python/pyspark/sql/functions.py", line 1958, in __call__
        "lit, array, struct or create_map.".format(c, type(c)))
    TypeError: Invalid UDF argument, not a str or Column: a of type <type 
'unicode'>. For Column literals use sql.functions lit, array, struct or 
create_map.
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to