Specifies the expressions on which to perform an aggregation operation.
GROUP BY expression1 [, expression2 ...]
expression |
An expression using constants, which can contain one or more columns from the input window or stream. However, an expression cannot use aggregate functions. |
It combines one or more input rows into a single row of output. Typically, GROUP BY is used for aggregation. The query will contain a GROUP BY to specify how to group the inputs, and one or more of the column expressions in the SELECT clause will use an aggregate function to compute aggregate values for the group.
Note that the GROUP BY clause must reference input columns directly. It cannot use aliases defined in the local SELECT clause.
The GROUP BY clause collects together the rows according to T.Symbol:
CREATE WINDOW Window1 SCHEMA (Symbol STRING, MaxPrice INTEGER) PRIMARY KEY DEDUCED KEEP ALL AS SELECT T.Symbol, max(T.Price) MaxPrice FROM Trades T GROUP BY T.Symbol