Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink DataFrame
  • PyFlink Common
  • API Reference
  • PyFlink Table
  • User Defined Functions
  • pyflink.table.udf.udtf

pyflink.table.udf.udtf#

udtf(f: Callable | TableFunction | Type, input_types: List[DataType] | DataType | str | List[str] | None = None, result_types: List[DataType] | DataType | str | List[str] | None = None, deterministic: bool | None = None, name: str | None = None) → UserDefinedTableFunctionWrapper[source]#
udtf(f: None = None, input_types: List[DataType] | DataType | str | List[str] | None = None, result_types: List[DataType] | DataType | str | List[str] | None = None, deterministic: bool | None = None, name: str | None = None) → Callable[[Callable | TableFunction | Type], UserDefinedTableFunctionWrapper]

Helper method for creating a user-defined table function.

Example

>>> # The input_types is optional.
>>> @udtf(result_types=[DataTypes.BIGINT(), DataTypes.BIGINT()])
... def range_emit(s, e):
...     for i in range(e):
...         yield s, i

>>> # Specify result_types via string
>>> @udtf(result_types=['BIGINT', 'BIGINT'])
... def range_emit(s, e):
...     for i in range(e):
...         yield s, i

>>> # Specify result_types via row string
>>> @udtf(result_types='Row<a BIGINT, b BIGINT>')
... def range_emit(s, e):
...     for i in range(e):
...         yield s, i

>>> class MultiEmit(TableFunction):
...     def eval(self, i):
...         return range(i)
>>> multi_emit = udtf(MultiEmit(), DataTypes.BIGINT(), DataTypes.BIGINT())
Parameters:
  • f – user-defined table function.

  • input_types – optional, the input data types.

  • result_types – the result data types.

  • name – the function name.

  • deterministic – the determinism of the function’s results. True if and only if a call to this function is guaranteed to always return the same result given the same parameters. (default True)

Returns:

UserDefinedTableFunctionWrapper or function.

Added in version 1.11.0.

previous

pyflink.table.udf.TableFunction

next

pyflink.table.udf.AggregateFunction

On this page
  • udtf()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.