Github user ueshin commented on a diff in the pull request:
https://github.com/apache/spark/pull/20171#discussion_r161710081
--- Diff: python/pyspark/sql/context.py ---
@@ -174,18 +174,23 @@ def range(self, start, end=None, step=1,
numPartitions=None):
@ignore_unicode_prefix
@since(1.2)
- def registerFunction(self, name, f, returnType=StringType()):
+ def registerFunction(self, name, f, returnType=None):
"""Registers a Python function (including lambda function) or a
:class:`UserDefinedFunction`
- as a UDF. The registered UDF can be used in SQL statement.
+ as a UDF. The registered UDF can be used in SQL statements.
- In addition to a name and the function itself, the return type can
be optionally specified.
- When the return type is not given it default to a string and
conversion will automatically
- be done. For any other return type, the produced object must
match the specified type.
+ :func:`spark.udf.register` is an alias for
:func:`sqlContext.registerFunction`.
--- End diff --
:func:`sqlContext.registerFunction` is an alias for
:func:`spark.udf.register`. ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]