Package org.apache.flink.table.api
Interface GroupWindowedTable
@PublicEvolving
public interface GroupWindowedTable
A table that has been windowed for
GroupWindows.-
Method Summary
Modifier and TypeMethodDescriptiongroupBy(org.apache.flink.table.expressions.Expression... fields) Groups the elements by a mandatory window and one or more optional grouping attributes.
-
Method Details
-
groupBy
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:
tab.window([groupWindow].as("w")).groupBy($("w"), $("key")).select($("key"), $("value").avg());Scala Example:
tab.window([groupWindow] as 'w)).groupBy('w, 'key).select('key, 'value.avg)
-