User Defined Functions#

Scalar Function#

A user-defined scalar functions maps zero, one, or multiple scalar values to a new scalar value.

ScalarFunction()

Base interface for user-defined scalar function.

udf([f, input_types, result_type, ...])

Helper method for creating a user-defined function.

Table Function#

A user-defined table function creates zero, one, or multiple rows to a new row value.

TableFunction()

Base interface for user-defined table function.

udtf([f, input_types, result_types, ...])

Helper method for creating a user-defined table function.

Aggregate Function#

A user-defined aggregate function maps scalar values of multiple rows to a new scalar value.

AggregateFunction()

Base interface for user-defined aggregate function.

udaf([f, input_types, result_type, ...])

Helper method for creating a user-defined aggregate function.

Table Aggregate Function#

A user-defined table aggregate function maps scalar values of multiple rows to zero, one, or multiple rows (or structured types). If an output record consists of only one field, the structured record can be omitted, and a scalar value can be emitted that will be implicitly wrapped into a row by the runtime.

TableAggregateFunction()

Base class for a user-defined table aggregate function.

udtaf([f, input_types, result_type, ...])

Helper method for creating a user-defined table aggregate function.

DataView#

If an accumulator needs to store large amounts of data, pyflink.table.ListView and pyflink.table.MapView could be used instead of list and dict. These two data structures provide the similar functionalities as list and dict, however usually having better performance by leveraging Flink’s state backend to eliminate unnecessary state access. You can use them by declaring DataTypes.LIST_VIEW(…) and DataTypes.MAP_VIEW(…) in the accumulator type.

ListView()

A DataView that provides list-like functionality in the accumulator of an AggregateFunction when large amounts of data are expected.

MapView()

A DataView that provides dict-like functionality in the accumulator of an AggregateFunction when large amounts of data are expected.