Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In addition, this FLIP also adds EndOfStreamTrigger in GlobalWindows. GlobalWindows with EndOfStreamTrigger can be used with the DataStream API to specify whether the window will end allows creating a GlobalWindows that the window will be triggered only at the end of its inputs. DataStream programs (e.g. coGroup and aggregate) can take advantage of this information to significantly increase throughput and reduce resource utilization.

...

2) Improve usability. For use-case that needs to invoke DataStream APIs (e.g. KeyedStream#window) with a window assigner that covers all input data, users can use the off-the-shelf GlobalWindows with EndOfStreamTrigger provided in this FLIPto create a GlobalWindow that is only triggered at the end of its inputs, instead of writing tens of lines of code to define this a WindowAssigner subclass. 

...

Code Block
languagejava
@PublicEvolving
public class GlobalWindows extends WindowAssigner<Object, GlobalWindow> {
   ···                   
	
	    /**
     * Creates a GlobalWindows {@link WindowAssigner} that assigns all elements to the same {@link GlobalWindow}.
     * GlobalWindow}. The window is only useful if you also specify a custom trigger. Otherwise, the window will
     * window will never be triggered and no computation will be performed.
     */     
	public static GlobalWindows create() {
        ...
    }      

    /**
     * Creates a new {@link WindowAssigner} with {@link EndOfStreamTrigger} that assigns all
     * elements to the same {@link GlobalWindow}
     * and the defaultwindow triggeris firestriggered if and only if the
     * input stream is ended.
     *
     * @return The global window policy with {@link EndOfStreamTrigger} as default trigger.
     */
    /
	public static GlobalWindows createWithEndOfStreamTrigger() {
        ...
    }

 }

...

  • WindowOperator: When used with GlobalWindows that is created with the method createWithEndOfStreamTrigger as the window assigner and EndOfStreamTrigger as the trigger
  • StreamSortOperator


5) When DataStream API like DataStream#CoGroup is invoked with GlobalWindows and EndOfStreamTrigger as the window assigner and trigger, the WindowOperator will check if the window assigner is an instance of GlobalWindow and the trigger is an instance of EndOfStreamTriggeronly triggers at the end of the inputs. If true, the operator will have OperatorAttributes with isOutputOnlyAfterEndOfStream = true to achieve higher throughput by using the optimizations in batch mode.

...

More specifically, the following DataStream API can benefit from using GlobalWindows with EndOfStreamTriggerwhich is created with the method createWithEndOfStreamTrigger.

  • DataStream#windowAll
  • KeyedStream#window
  • CoGroupedStreams#Where#EqualTo#window
  • JoinedStreams#Where#EqualTo#window

...