Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.GroupWindowedTable.group_by#

GroupWindowedTable.group_by(*fields: Union[str, 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.

previous

pyflink.table.GroupedTable.flat_aggregate

next

pyflink.table.WindowGroupedTable.select

Show Source

Created using Sphinx 4.5.0.