Class WindowAssigner<T,W extends Window>

java.lang.Object
org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<T,W>
Type Parameters:
T - The type of elements that this WindowAssigner can assign windows to.
W - The type of Window that this assigner assigns.
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GlobalWindows, MergingWindowAssigner, SlidingEventTimeWindows, SlidingProcessingTimeWindows, TumblingEventTimeWindows, TumblingProcessingTimeWindows

@PublicEvolving public abstract class WindowAssigner<T,W extends Window> extends Object implements Serializable
A WindowAssigner assigns zero or more Windows to an element.

In a window operation, elements are grouped by their key (if available) and by the windows to which it was assigned. The set of elements with the same key and window is called a pane. When a Trigger decides that a certain pane should fire the WindowFunction is applied to produce output elements for that pane.

See Also:
  • Constructor Details

    • WindowAssigner

      public WindowAssigner()
  • Method Details

    • assignWindows

      public abstract Collection<W> assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context)
      Returns a Collection of windows that should be assigned to the element.
      Parameters:
      element - The element to which windows should be assigned.
      timestamp - The timestamp of the element.
      context - The WindowAssigner.WindowAssignerContext in which the assigner operates.
    • getDefaultTrigger

      public abstract Trigger<T,W> getDefaultTrigger()
      Returns the default trigger associated with this WindowAssigner.

      1. If you override getDefaultTrigger(), the getDefaultTrigger() will be invoked and the getDefaultTrigger(StreamExecutionEnvironment env) won't be invoked. 2. If you don't override getDefaultTrigger(), the getDefaultTrigger(StreamExecutionEnvironment env) will be invoked in the default implementation of the getDefaultTrigger().

    • getWindowSerializer

      public abstract org.apache.flink.api.common.typeutils.TypeSerializer<W> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
      Returns a TypeSerializer for serializing windows that are assigned by this WindowAssigner.
    • isEventTime

      public abstract boolean isEventTime()
      Returns true if elements are assigned to windows based on event time, false otherwise.