I’m very new to Apache Flink and its API.I want to create Java program which will do event time based processing with tumbling windows. I want to count the number of elements in the given window. However, I couldn't figure how to do that.
Asked
Active
Viewed 820 times
1 Answers
2
So, if you want to calculate the number of elements in window, probably the simplest idea is like this. Assuming you have dataset
variable representing your dataset:
dataset.map(element => (element,1)).timeWindowAll(Time.seconds(5)).sum(1)
This should give you the number of elements in the window.

Dominik Wosiński
- 3,769
- 1
- 8
- 22