window

The window function allows the grouping of existing KeyedDataStreams by time or other conditions. The following transformation emits groups of records by a time window of 10 seconds:

In Java:

inputStream.keyBy(0).window(TumblingEventTimeWindows.of(Time.seconds(10)));

In Scala:

inputStream.keyBy(0).window(TumblingEventTimeWindows.of(Time.seconds(10)))

Flink defines slices of data called windows to process potentially infinite data streams.

This helps the processing of data in chunks using transformations. To do windowing on a stream, assign a key on which the distribution can be made and a function that describes what transformations to perform on a windowed stream.

To slice streams into windows, you can use pre-implemented Flink window assigners. Use options such as tumbling windows, sliding windows, and global and session windows.

Flink also allows you to write custom window assigners by extending the WindowAssigner class.

Let's examine how these assigners work in the following sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset