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.create_temporary_function#

StreamTableEnvironment.create_temporary_function(path: str, function: Union[pyflink.table.udf.UserDefinedFunctionWrapper, pyflink.table.udf.AggregateFunction])#

Registers a python user defined function class as a temporary catalog function.

Compared to .. seealso:: create_temporary_system_function() with a globally defined name, catalog functions are always (implicitly or explicitly) identified by a catalog and database.

Temporary functions can shadow permanent ones. If a permanent function under a given name exists, it will be inaccessible in the current session. To make the permanent function available again one can drop the corresponding temporary function.

Example:

>>> table_env.create_temporary_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.create_temporary_function("add", add)

>>> class SubtractOne(ScalarFunction):
...     def eval(self, i):
...         return i - 1
>>> table_env.create_temporary_function(
...     "subtract_one", udf(SubtractOne(), result_type=DataTypes.BIGINT()))
Parameters
  • path – The path under which the function will be registered. See also the TableEnvironment class description for the format of the path.

  • function – The function class containing the implementation. The function must have a public no-argument constructor and can be founded in current Java classloader.

New in version 1.12.0.

previous

pyflink.table.table_environment.StreamTableEnvironment.create_table

next

pyflink.table.table_environment.StreamTableEnvironment.create_temporary_system_function

Show Source

Created using Sphinx 4.5.0.