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 ofWindowthat 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA context provided to theWindowAssignerthat allows it to query the current processing time. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Collection<W>assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context) Returns aCollectionof windows that should be assigned to the element.Returns the default trigger associated with thisWindowAssigner.abstract org.apache.flink.api.common.typeutils.TypeSerializer<W>getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig) Returns aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner.abstract booleanReturnstrueif elements are assigned to windows based on event time,falseotherwise.
-
Constructor Details
-
WindowAssigner
public WindowAssigner()
-
-
Method Details
-
assignWindows
public abstract Collection<W> assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context) Returns aCollectionof 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- TheWindowAssigner.WindowAssignerContextin which the assigner operates.
-
getDefaultTrigger
Returns the default trigger associated with thisWindowAssigner.1. If you override
getDefaultTrigger(), thegetDefaultTrigger()will be invoked and thegetDefaultTrigger(StreamExecutionEnvironment env)won't be invoked. 2. If you don't overridegetDefaultTrigger(), thegetDefaultTrigger(StreamExecutionEnvironment env)will be invoked in the default implementation of thegetDefaultTrigger(). -
getWindowSerializer
public abstract org.apache.flink.api.common.typeutils.TypeSerializer<W> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig) Returns aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner. -
isEventTime
public abstract boolean isEventTime()Returnstrueif elements are assigned to windows based on event time,falseotherwise.
-