Skip to main content

avg (Aggregate Function)

Calculates the average for all the events.

Syntax

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

QUERY PARAMETERS

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
argThe value that need to be averaged.INT LONG DOUBLE FLOATNoYes

Example 1

    insert into barStream
select avg(temp) as avgTemp
from fooStream WINDOW TUMBLING_TIME;

avg(temp) returns the average temp value for all the events based on their arrival and expiration.