[ https://issues.apache.org/jira/browse/SPARK-19162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
holdenk resolved SPARK-19162. ----------------------------- Resolution: Fixed Fix Version/s: 2.2.0 > UserDefinedFunction constructor should verify that func is callable > ------------------------------------------------------------------- > > Key: SPARK-19162 > URL: https://issues.apache.org/jira/browse/SPARK-19162 > Project: Spark > Issue Type: Sub-task > Components: PySpark, SQL > Affects Versions: 1.6.0, 2.0.0, 2.1.0, 2.2.0 > Reporter: Maciej Szymkiewicz > Assignee: Maciej Szymkiewicz > Priority: Minor > Fix For: 2.2.0 > > > Current state > Right now `UserDefinedFunctions` don't perform any input type validation. It > will accept non-callable objects just to fail with hard to understand > traceback: > {code} > In [1]: from pyspark.sql.functions import udf > In [2]: df = spark.range(0, 1) > In [3]: f = udf(None) > In [4]: df.select(f()).first() > 17/01/07 19:30:50 ERROR Executor: Exception in task 2.0 in stage 2.0 (TID 7) > ... > Py4JJavaError: An error occurred while calling o51.collectToPython. > ... > TypeError: 'NoneType' object is not callable > ... > {code} > Proposed > Apply basic validation for {{func}} argument: > {code} > In [7]: udf(None) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > <ipython-input-7-0765fbe657a9> in <module>() > ----> 1 udf(None) > ... > TypeError: func should be a callable object (a function or an instance of a > class with __call__). Got <class 'NoneType'> > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org