I am playing with the externalTime / externalTimeBatch in order to calculate average value for events that happen within a certain time interval as below
from sensorStream#window.externalTimeBatch(meta_timestamp, 60 sec, meta_timestamp, 60 sec) [sensorValue > 100]
select meta_timestamp, avg(sensorValue) as sensorValue
insert into filteredStream
The issue I am having is that the average is always calculated for all events from the begining, rather then getting reset on the time interval.
Whats the best way to use it.
Thanks.