Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.table_environment.StreamTableEnvironment.register_function#

StreamTableEnvironment.register_function(name: str, function: pyflink.table.udf.UserDefinedFunctionWrapper)#

Registers a python user-defined function under a unique name. Replaces already existing user-defined function under this name.

Example:

>>> table_env.register_function(
...     "add_one", udf(lambda i: i + 1, result_type=DataTypes.BIGINT()))

>>> @udf(result_type=DataTypes.BIGINT())
... def add(i, j):
...     return i + j
>>> table_env.register_function("add", add)

>>> class SubtractOne(ScalarFunction):
...     def eval(self, i):
...         return i - 1
>>> table_env.register_function(
...     "subtract_one", udf(SubtractOne(), result_type=DataTypes.BIGINT()))
Parameters
  • name – The name under which the function is registered.

  • function – The python user-defined function to register.

New in version 1.10.0.

Note

Deprecated in 1.12. Use create_temporary_system_function() instead.

previous

pyflink.table.table_environment.StreamTableEnvironment.register_catalog

next

pyflink.table.table_environment.StreamTableEnvironment.register_java_function

Show Source

Created using Sphinx 4.5.0.