HyukjinKwon commented on code in PR #41316:
URL: https://github.com/apache/spark/pull/41316#discussion_r1220854589
##########
python/pyspark/sql/functions.py:
##########
@@ -10403,6 +10405,84 @@ def udf(
return _create_py_udf(f=f, returnType=returnType, useArrow=useArrow)
+def udtf(
+ cls: Optional[Type] = None,
+ *,
+ returnType: Union[StructType, str],
+) -> Union[UserDefinedTableFunction, functools.partial]:
+ """Creates a user defined table function (UDTF).
+
+ .. versionadded:: 3.5.0
+
+ Parameters
+ ----------
+ cls : class
+ the Python user-defined table function handler class.
+ returnType : :class:`pyspark.sql.types.StructType` or str
+ the return type of the user-defined table function. The value can be
either a
+ :class:`pyspark.sql.types.StructType` object or a DDL-formatted struct
type string.
+
+ Examples
+ --------
+ Implement the UDTF class.
+ >>> class TestUDTF:
+ ... def eval(self, *args: Any):
+ ... yield "hello", "world"
+
+ Create the UDTF
Review Comment:
```suggestion
Create the UDTF
```
and dittos for the ones below.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]