Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/20217#discussion_r160861750 --- Diff: python/pyspark/sql/catalog.py --- @@ -255,26 +255,67 @@ def registerFunction(self, name, f, returnType=StringType()): >>> _ = spark.udf.register("stringLengthInt", len, IntegerType()) >>> spark.sql("SELECT stringLengthInt('test')").collect() [Row(stringLengthInt(test)=4)] + """ + + # This is to check whether the input function is a wrapped/native UserDefinedFunction + if hasattr(f, 'asNondeterministic'): --- End diff -- Yea, but the wrapped UDF is also callable .. unfortunately :(. I suggested this way for this reason: in `udf.py` ```diff + wrapper._unwrapped = lambda: self return wrapper ``` and then ``` if hasattr(f, "_unwrapped"): f = f._unwrapped() if isinstance(f, UserDefinedFunction): ... else: ... ``` but it was no string opinion.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org