Context:
There is a ds: DataStream[Event] , and there are 3 types of Event: A, B, C.
Question: How to monitor occurrences of different Events in different interval of time?
i.e. Suppose there is only one event in a second, and it is in order.
ds = A, B, C, A, C, B, A, C, A, B, C....
Then,
occurrences of A in each 3 seconds are: 1, 1, 1, 1, 1, 1, 2, 1, 1...
occurrences of B in each 2 seconds are: 1, 1, 0, 0, 1, 1, 0, 0, 1, 1...
occurrences of C in each 4 seconds are: 1, 2, 2, 1, 2, 1, 1, 2....