Skip to content

Commit

Permalink
[SPARK-11860][PYSAPRK][DOCUMENTATION] Invalid argument specification …
Browse files Browse the repository at this point in the history
…for registerFunction [Python]

Straightforward change on the python doc

Author: Jeff Zhang <zjffdu@apache.org>

Closes #9901 from zjffdu/SPARK-11860.
  • Loading branch information
zjffdu authored and srowen committed Nov 25, 2015
1 parent 6385002 commit b9b6fbe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/pyspark/sql/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,15 @@ def range(self, start, end=None, step=1, numPartitions=None):
@ignore_unicode_prefix
@since(1.2)
def registerFunction(self, name, f, returnType=StringType()):
"""Registers a lambda function as a UDF so it can be used in SQL statements.
"""Registers a python function (including lambda function) as a UDF
so it 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.
:param name: name of the UDF
:param samplingRatio: lambda function
:param f: python function
:param returnType: a :class:`DataType` object
>>> sqlContext.registerFunction("stringLengthString", lambda x: len(x))
Expand Down

0 comments on commit b9b6fbe

Please sign in to comment.