pyflink.table.GroupWindowedTable.group_by#
- GroupWindowedTable.group_by(*fields: pyflink.table.expression.Expression) pyflink.table.table.WindowGroupedTable [source]#
Groups the elements by a mandatory window and one or more optional grouping attributes. The window is specified by referring to its alias.
If no additional grouping attribute is specified and if the input is a streaming table, the aggregation will be performed by a single task, i.e., with parallelism 1.
Aggregations are performed per group and defined by a subsequent
select()
clause similar to SQL SELECT-GROUP-BY query.Example:
>>> from pyflink.table.expressions import col, lit >>> tab.window(Tumble.over(lit(10).minutes).on(col('rowtime')).alias('w')) \ ... .group_by(col('w')) \ ... .select(col('a').sum.alias('a'), ... col('w').start.alias('b'), ... col('w').end.alias('c'), ... col('w').rowtime.alias('d'))
- Parameters
fields – Group keys.
- Returns
A window grouped table.