Class GlobalWindows
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<Object,GlobalWindow>
-
- org.apache.flink.streaming.api.windowing.assigners.GlobalWindows
-
- All Implemented Interfaces:
Serializable
@PublicEvolving public class GlobalWindows extends WindowAssigner<Object,GlobalWindow>
AWindowAssigner
that assigns all elements to the sameGlobalWindow
.Use this if you want to use a
Trigger
andEvictor
to do flexible, policy based windows.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GlobalWindows.EndOfStreamTrigger
A trigger that fires iff the input stream reaches EndOfStream.static class
GlobalWindows.NeverTrigger
A trigger that never fires, as default Trigger for GlobalWindows.-
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.windowing.assigners.WindowAssigner
WindowAssigner.WindowAssignerContext
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<GlobalWindow>
assignWindows(Object element, long timestamp, WindowAssigner.WindowAssignerContext context)
Returns aCollection
of windows that should be assigned to the element.static GlobalWindows
create()
Creates aWindowAssigner
that assigns all elements to the sameGlobalWindow
.static GlobalWindows
createWithEndOfStreamTrigger()
Creates aWindowAssigner
that assigns all elements to the sameGlobalWindow
and the window is triggered if and only if the input stream is ended.Trigger<Object,GlobalWindow>
getDefaultTrigger()
Returns the default trigger associated with thisWindowAssigner
.org.apache.flink.api.common.typeutils.TypeSerializer<GlobalWindow>
getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
Returns aTypeSerializer
for serializing windows that are assigned by thisWindowAssigner
.boolean
isEventTime()
Returnstrue
if elements are assigned to windows based on event time,false
otherwise.String
toString()
-
-
-
Method Detail
-
assignWindows
public Collection<GlobalWindow> assignWindows(Object element, long timestamp, WindowAssigner.WindowAssignerContext context)
Description copied from class:WindowAssigner
Returns aCollection
of windows that should be assigned to the element.- Specified by:
assignWindows
in classWindowAssigner<Object,GlobalWindow>
- 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 Trigger<Object,GlobalWindow> getDefaultTrigger()
Description copied from class:WindowAssigner
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()
.- Specified by:
getDefaultTrigger
in classWindowAssigner<Object,GlobalWindow>
-
create
public static GlobalWindows create()
Creates aWindowAssigner
that assigns all elements to the sameGlobalWindow
. The window is only useful if you also specify a custom trigger. Otherwise, the window will never be triggered and no computation will be performed.
-
createWithEndOfStreamTrigger
public static GlobalWindows createWithEndOfStreamTrigger()
Creates aWindowAssigner
that assigns all elements to the sameGlobalWindow
and the window is triggered if and only if the input stream is ended.
-
getWindowSerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<GlobalWindow> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
Description copied from class:WindowAssigner
Returns aTypeSerializer
for serializing windows that are assigned by thisWindowAssigner
.- Specified by:
getWindowSerializer
in classWindowAssigner<Object,GlobalWindow>
-
isEventTime
public boolean isEventTime()
Description copied from class:WindowAssigner
Returnstrue
if elements are assigned to windows based on event time,false
otherwise.- Specified by:
isEventTime
in classWindowAssigner<Object,GlobalWindow>
-
-