Skip to content

Commit

Permalink
[SPARK-23122][PYSPARK][FOLLOW-UP] Update the docs for UDF Registration
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

This PR is to update the docs for UDF registration

## How was this patch tested?

N/A

Author: gatorsmile <[email protected]>

Closes #20348 from gatorsmile/testUpdateDoc.
  • Loading branch information
gatorsmile committed Jan 22, 2018
1 parent 60175e9 commit 7328116
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/pyspark/sql/udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def __init__(self, sparkSession):
@ignore_unicode_prefix
@since("1.3.1")
def register(self, name, f, returnType=None):
"""Registers a Python function (including lambda function) or a user-defined function
in SQL statements.
"""Register a Python function (including lambda function) or a user-defined function
as a SQL function.
:param name: name of the user-defined function in SQL statements.
:param f: a Python function, or a user-defined function. The user-defined function can
Expand All @@ -210,6 +210,10 @@ def register(self, name, f, returnType=None):
be either a :class:`pyspark.sql.types.DataType` object or a DDL-formatted type string.
:return: a user-defined function.
To register a nondeterministic Python function, users need to first build
a nondeterministic user-defined function for the Python function and then register it
as a SQL function.
`returnType` can be optionally specified when `f` is a Python function but not
when `f` is a user-defined function. Please see below.
Expand Down Expand Up @@ -297,7 +301,7 @@ def register(self, name, f, returnType=None):
@ignore_unicode_prefix
@since(2.3)
def registerJavaFunction(self, name, javaClassName, returnType=None):
"""Register a Java user-defined function so it can be used in SQL statements.
"""Register a Java user-defined function as a SQL function.
In addition to a name and the function itself, the return type can be optionally specified.
When the return type is not specified we would infer it via reflection.
Expand Down Expand Up @@ -334,7 +338,7 @@ def registerJavaFunction(self, name, javaClassName, returnType=None):
@ignore_unicode_prefix
@since(2.3)
def registerJavaUDAF(self, name, javaClassName):
"""Register a Java user-defined aggregate function so it can be used in SQL statements.
"""Register a Java user-defined aggregate function as a SQL function.
:param name: name of the user-defined aggregate function
:param javaClassName: fully qualified name of java class
Expand Down

0 comments on commit 7328116

Please sign in to comment.