Skip to main content

sum (Aggregate Function)

Returns the sum for all the events.

Syntax

<LONG|DOUBLE> sum(<INT|LONG|DOUBLE|FLOAT> arg)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
argThe value that needs to be summed.INT LONG DOUBLE FLOATNoYes

Example

@info(name = 'query1')
INSERT INTO outputStream
SELECT sum(volume) AS sumOfVolume
FROM inputStream;

This query, named 'query1', processes records from the inputStream and calculates the sum of the volume values using the sum(volume) function. The resulting value, named sumOfVolume, represents the total volume and is inserted into the outputStream.

Essentially, this query processes records in the inputStream and creates new records in the outputStream containing the sum of the volume values.