pyflink.table.Table.window#
- Table.window(window: pyflink.table.window.GroupWindow) pyflink.table.table.GroupWindowedTable [source]#
Defines group window on the records of a table.
A group window groups the records of a table by assigning them to windows defined by a time or row interval.
For streaming tables of infinite size, grouping into windows is required to define finite groups on which group-based aggregates can be computed.
For batch tables of finite size, windowing essentially provides shortcuts for time-based groupBy.
Note
Computing windowed aggregates on a streaming table is only a parallel operation if additional grouping attributes are added to the
group_by()
clause. If thegroup_by()
only references a GroupWindow alias, the streamed table will be processed by a single task, i.e., with parallelism 1.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
window – A
GroupWindow
created fromTumble
,Session
orSlide
.- Returns
A group windowed table.