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.udaf

pyflink.table.udf.udaf#

udaf(f: Callable | AggregateFunction | Type, input_types: List[DataType] | DataType | str | List[str] | None = None, result_type: DataType | str | None = None, accumulator_type: DataType | str | None = None, deterministic: bool | None = None, name: str | None = None, func_type: str = 'general') → UserDefinedAggregateFunctionWrapper[source]#
udaf(f: None = None, input_types: List[DataType] | DataType | str | List[str] | None = None, result_type: DataType | str | None = None, accumulator_type: DataType | str | None = None, deterministic: bool | None = None, name: str | None = None, func_type: str = 'general') → Callable[[Callable | AggregateFunction | Type], UserDefinedAggregateFunctionWrapper]

Helper method for creating a user-defined aggregate function.

Example

>>> # The input_types is optional.
>>> @udaf(result_type=DataTypes.FLOAT(), func_type="pandas")
... def mean_udaf(v):
...     return v.mean()

>>> # Specify result_type via string
>>> @udaf(result_type='FLOAT', func_type="pandas")
... def mean_udaf(v):
...     return v.mean()
Parameters:
  • f – user-defined aggregate function.

  • input_types – optional, the input data types.

  • result_type – the result data type.

  • accumulator_type – optional, the accumulator data type.

  • 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)

  • name – the function name.

  • func_type – the type of the python function, available value: general, pandas, (default: general)

Returns:

UserDefinedAggregateFunctionWrapper or function.

Added in version 1.12.0.

previous

pyflink.table.udf.AggregateFunction

next

pyflink.table.udf.TableAggregateFunction

On this page
  • udaf()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.