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
  • Table
  • pyflink.table.WindowGroupedTable.aggregate

pyflink.table.WindowGroupedTable.aggregate#

WindowGroupedTable.aggregate(func: Expression | UserDefinedAggregateFunctionWrapper) → AggregatedTable[source]#

Performs an aggregate operation on a window grouped table. You have to close the aggregate with a select statement.

Example:

>>> agg = udaf(lambda a: (a.mean(), a.max()),
...               result_type=DataTypes.ROW(
...                   [DataTypes.FIELD("a", DataTypes.FLOAT()),
...                    DataTypes.FIELD("b", DataTypes.INT())]),
...               func_type="pandas")
>>> window_grouped_table.group_by(col("w")) \
...     .aggregate(agg(col('b'))) \
...     .alias("c", "d") \
...     .select(col('c'), col('d'))
>>> # take all the columns as inputs
>>> # pd is a Pandas.DataFrame
>>> agg_row = udaf(lambda pd: (pd.a.mean(), pd.b.max()),
...               result_type=DataTypes.ROW(
...                   [DataTypes.FIELD("a", DataTypes.FLOAT()),
...                    DataTypes.FIELD("b", DataTypes.INT())]),
...               func_type="pandas")
>>> window_grouped_table.group_by(col("w"), col("a")).aggregate(agg_row)
Parameters:

func – user-defined aggregate function.

Returns:

The result table.

Added in version 1.13.0.

previous

pyflink.table.WindowGroupedTable.select

next

pyflink.table.OverWindowedTable.select

On this page
  • WindowGroupedTable.aggregate()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.