Windows and triggers
Table of contents
Overview
Windows split the stream into some “blocks” of finite size and all transformations over the stream will be applied to these “blocks” of the data. In this section you can find base information about window operations, to read more about windows and triggers in the Apache Beam’s programming guide.
Windowing methods
Method | Description |
---|---|
withWindow( windowFn, options ) | Applies defined window function with specified options to the input stream. Arguments: · windowFn: WindowFn<T, *> - a window function· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withWindowByDays( number, options ) | Applies the window function to combine elements into periods measured by days. Arguments: · number: Int - a number of days· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withWindowByWeeks( number, startDayOfWeek, options ) | Applies the window function to combine elements into periods measured by weeks. Arguments: · number: Int - a number of weeks· startDayOfWeek: Int - the day of week to start, where 1 is Monday and 7 is Sunday· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withWindowByMonths( number, options ) | Applies the window function to combine elements into periods measured by months. Arguments: · number: Int - a number of months· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withWindowByYears( number, options ) | Applies the window function to combine elements into periods measured by years. Arguments: · number: Int - a number of years· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withGlobalWindow( options ) | Combines all input elements into one common window. Arguments: · options: Configurator<WindowFn<T>> - additional configurations for the window function |
withFixedWindow( duration, offset, options ) | Applies the window function to combine elements into fixed-size timestamp-based windows. Arguments: · duration: Duration - the size of windows· offset: Duration - offset before the start of windows (default: Duration.ZERO )· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withSessionWindows( gap, options ) | Applies the window function to combine elements into sessions separated by periods with no input for at least the gap duration.Arguments: · gap: Duration - the size of the gap between sessions· options: Configurator<WindowFn<T>> - additional configurations for the window function |
withSlidingWindow( size, period, offset, options ) | Applies the window function to combine elements into possibly overlapping fixed-size timestamp-based windows. Arguments: · duration: Duration - the size of windows· period: Duration - a period between windows· offset: Duration - offset before the start of windows (default: Duration.ZERO )· options: Configurator<WindowFn<T>> - additional configurations for the window function |