Aggregate. Returns a value from a group, based on the last row applied into that group. Returned values include NULLS.
valueinserted ( expression )
expression |
The expression accepts all datatypes. |
Returns the value of the expression computed using the most recent event used to insert/update the group. If the current event removes a row from the group then it returns a NULL.
This function is considered an additive function. Using only additive functions in the projection of a SELECT statement allows the server to optimize the aggregation, which results in greater throughput and lower memory utilization.
CREATE INPUT WINDOW inWin SCHEMA ( id long, symbol string, value money(2) ) PRIMARY KEY ( id ) KEEP 5 MINUTES; CREATE OUTPUT WINDOW stats PRIMARY KEY DEDUCED KEEP 5 MINUTES AS SELECT i.symbol, min(i.value) minValue, max(i.value) maxValue, avg(i.value) avgValue, valueInserted(i.value) lastValue FROM inWin i GROUP BY i.symbol;