0

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.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
Chirag
  • 1
  • 2

1 Answers1

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