Skip to main content

collect (Aggregate Function)

Collects multiple values to construct a list.

Syntax

<OBJECT> list:collect(<OBJECT|INT|LONG|FLOAT|DOUBLE|BOOL|STRING> value)
<OBJECT> list:collect(<OBJECT|INT|LONG|FLOAT|DOUBLE|BOOL|STRING> value, <BOOL> is.distinct)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
valueValue of the list elementOBJECT INT LONG FLOAT DOUBLE BOOL STRINGNoYes
is.distinctIf true only distinct elements are collectedfalseBOOLYesYes

Example 1

insert into OutputStream
select list:collect(symbol) as stockSymbols
from StockStream WINDOW TUMBLING_LENGTH(10);

For the window expiration of 10 events, the collect() function collects attributes of symbol to a single list and return as stockSymbols.