Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

Siddhi Inbuilt Aggregate Functions in wiki format

Following are the supported inbuilt aggregate functions  of Siddhi.

Table of Contents
maxLevel3
minLevel3

sum
Anchor
sum
sum

Syntax<long|

...

double> sum(<int|long|double|

...

float> arg)
Extension Type

...

Aggregate Function

...

Description

...

Calculates the sum for all the events.
Parameter

...

The value that

...

needs to be summed.
Return Type

...

Returns long if the input parameter type is int or long

...

, and returns double if the input parameter type is float or double.
Examples

...

  • sum(20) returns the sum of 20s as a long value for each event arrival and expiry. 
  • sum(temp) returns the sum of all temp attributes based on each event arrival and expiry.

avg
Anchor
avg
avg

Syntax<double> avg(<int|long|double|float> arg)
Extension TypeAggregate Function
DescriptionCalculates the average for all the events.
Parameter arg : The value that need to be averaged.
Return TypeReturns the calculated average value as a double.
Exampleavg(temp) returns the average temp value for all the events based on their arrival and expiry.

max
Anchor
max
max

Syntax<int|long|double|float> max(<int|long|double|float> arg)
Extension TypeAggregate Function
DescriptionReturns the maximum value for all the events.
Parameter arg : The value that needs to be compared to find the maximum value.
Return TypeReturns the maximum value in the same data type as the input.
Examplemax(temp) returns the maximum temp value recorded for all the events based on their arrival and expiry.

min
Anchor
min
min
 

Syntax<int|long|double|float> min(<int|long|double|float> arg)
Extension TypeAggregate Function
DescriptionReturns the minimum value for all the events.
Parameter arg : The value that needs to be compared to find the minimum value.
Return TypeReturns the minimum value in the same type as the input.
Examplemin(temp) returns the minimum temp value recorded for all the events based on their arrival and expiry.

count
Anchor
count
count

Syntax<long> count()
Extension TypeAggregate Function
DescriptionReturns the count of all the events.
Return TypeReturns the event count as a long.
Example count() returns the count of all the events.

stddev
Anchor
stddev
stddev

Syntax<double> stddev(<int|long|double|float> arg)
Extension TypeAggregate Function
DescriptionReturns the calculated standard deviation for all the events.
Parameter arg : The value that should be used to calculate the standard deviation.
Return TypeReturns the calculated standard deviation value as a double.
Examplestddev(temp) returns the calculated standard deviation of temp for all the events based on their arrival and expiry.
Excerpt
hiddentrue

average

Todo add other aggregate functions

...