Skip to main content

sizeOfSet (Function)

Returns the size of an object of type java.util.Set.

Syntax

<INT> sizeOfSet(<OBJECT> set)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
setThe set object. This parameter should be of type java.util.Set. A set object may be created by the set attribute aggregator.OBJECTNoYes

Example 1

insert into initStream
select initSet(symbol) as initialSet
from stockStream;

insert into distinctStockStream
select union(initialSet) as distinctSymbols
from initStream WINDOW TUMBLING_TIME(10 sec);

insert into sizeStream
select sizeOfSet(distinctSymbols) sizeOfSymbolSet
from distinctStockStream;

The sizeStream stream will output the number of distinct stock symbols received during a sliding window of 10 seconds.