Skip to main content

count (Aggregate Function)

Returns the count of all the events.

Syntax

<LONG> count()
<LONG> count(<INT|LONG|DOUBLE|FLOAT|STRING|BOOL|OBJECT> arg)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
argThis function accepts one parameter. It can belong to any one of the available types.INT LONG DOUBLE FLOAT STRING BOOL OBJECTYesYes

Example 1

@info(name = 'query1')
INSERT INTO barStream
SELECT count() AS count
FROM fooStream WINDOW TUMBLING_TIME(10 sec);

This query processes records from the fooStream using a tumbling time-based window of 10 seconds. For each window, it calculates the total number of records using the count() function. The result is aliased as count and inserted into the barStream.

Essentially, this query computes the count of records within each 10-second window in the fooStream and inserts the resulting count value into the barStream.