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

    https://github.com/apache/spark/pull/21383#discussion_r191409616
  
    --- Diff: python/pyspark/sql/udf.py ---
    @@ -157,7 +157,17 @@ def _create_judf(self):
             spark = SparkSession.builder.getOrCreate()
             sc = spark.sparkContext
     
    -        wrapped_func = _wrap_function(sc, self.func, self.returnType)
    +        func = fail_on_stopiteration(self.func)
    +
    +        # prevent inspect to fail
    +        # e.g. inspect.getargspec(sum) raises
    +        # TypeError: <built-in function sum> is not a Python function
    +        try:
    +            func._argspec = _get_argspec(self.func)
    +        except TypeError:
    --- End diff --
    
    I would do:
    
    ```
        if evalType in (PythonEvalType.SQL_SCALAR_PANDAS_UDF,
                        PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF,
                        PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF):
            # the hack
    ```
    
    to reduce the scope being affected by this logic more. Did this fix not 
working in your local?
    
    this fix is rather a hack and we should clean up after merging this in ... 


---

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

Reply via email to