Sophisticated windowing

Windowing can be used to group elements from an unbounded stream together by time, element count, or custom logic.

Windows split the incoming stream into “buckets” of finite size, over which you can apply computations. The size of the split can be a period of time (event or processing time) or other custom logic. A window has a trigger and a function defined for it. The function contains the computation that needs to be completed in the given time on the contents of the window. Trigger specifies the condition in which the function is going to be applied. Also, with an evictor, elements can be removed from a window after the trigger, and before or after the function is applied. A window assigner has to be specified for the stream to define how elements are assigned to windows.

The followings are the types of window assigners:
  • Tumbling windows
  • Sliding windows
  • Session windows
  • Global windows