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
AWindowAssignerassigns zero or moreWindowsto 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
Triggerdecides that a certain pane should fire theWindowFunctionis applied to produce output elements for that pane.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWindowAssigner.WindowAssignerContextA context provided to theWindowAssignerthat allows it to query the current processing time.
-
Constructor Summary
Constructors Constructor Description WindowAssigner()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Collection<W>assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context)Returns aCollectionof windows that should be assigned to the element.abstract Trigger<T,W>getDefaultTrigger()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 booleanisEventTime()Returnstrueif elements are assigned to windows based on event time,falseotherwise.
-
-
-
Method Detail
-
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
public abstract Trigger<T,W> 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.
-
-