I can't get my head around how to do something which I thought would be quite simple. I have a stream of events with events arriving at random intervals every 3-5 seconds. Once I receive an event I don't need to respond to another event of that same type for another minute. Once that minute is up I want to wait until a new event of that same type arrives and start the process again. Can you give me some pointers?
Let S be the input stream and let schema of S have an attribute "type". Then,
select T.Ac1 from S
PARTITION BY type
A.c1 as Ac1
A as (prev(A.c1,1,60*10^9) is null)
) as T
What the above query does is it outputs the input event if there is no previous event of the same type (the PARTITION BY clause creates 1 logical sub-stream per type) that was received within the last 60 seconds (expressed in nanos)