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 ofWindow
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
AWindowAssigner
assigns zero or moreWindows
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 theWindowFunction
is applied to produce output elements for that pane.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WindowAssigner.WindowAssignerContext
A context provided to theWindowAssigner
that 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 aCollection
of 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 aTypeSerializer
for serializing windows that are assigned by thisWindowAssigner
.abstract boolean
isEventTime()
Returnstrue
if elements are assigned to windows based on event time,false
otherwise.
-
-
-
Method Detail
-
assignWindows
public abstract Collection<W> assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context)
Returns aCollection
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
- TheWindowAssigner.WindowAssignerContext
in 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 aTypeSerializer
for serializing windows that are assigned by thisWindowAssigner
.
-
isEventTime
public abstract boolean isEventTime()
Returnstrue
if elements are assigned to windows based on event time,false
otherwise.
-
-