@PublicEvolving public class GlobalWindows extends WindowAssigner<Object,GlobalWindow>
WindowAssigner
that assigns all elements to the same GlobalWindow
.
Use this if you want to use a Trigger
and Evictor
to do flexible, policy based windows.
Modifier and Type | Class and 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.
|
WindowAssigner.WindowAssignerContext
Modifier and Type | Method and Description |
---|---|
Collection<GlobalWindow> |
assignWindows(Object element,
long timestamp,
WindowAssigner.WindowAssignerContext context)
Returns a
Collection of windows that should be assigned to the element. |
static GlobalWindows |
create()
Creates a
WindowAssigner that assigns all elements to the same GlobalWindow . |
static GlobalWindows |
createWithEndOfStreamTrigger()
Creates a
WindowAssigner that assigns all elements to the same GlobalWindow
and the window is triggered if and only if the input stream is ended. |
Trigger<Object,GlobalWindow> |
getDefaultTrigger()
Returns the default trigger associated with this
WindowAssigner . |
Trigger<Object,GlobalWindow> |
getDefaultTrigger(StreamExecutionEnvironment env)
Returns the default trigger associated with this
WindowAssigner . |
TypeSerializer<GlobalWindow> |
getWindowSerializer(ExecutionConfig executionConfig)
Returns a
TypeSerializer for serializing windows that are assigned by this WindowAssigner . |
boolean |
isEventTime()
Returns
true if elements are assigned to windows based on event time, false
otherwise. |
String |
toString() |
public Collection<GlobalWindow> assignWindows(Object element, long timestamp, WindowAssigner.WindowAssignerContext context)
WindowAssigner
Collection
of windows that should be assigned to the element.assignWindows
in class WindowAssigner<Object,GlobalWindow>
element
- The element to which windows should be assigned.timestamp
- The timestamp of the element.context
- The WindowAssigner.WindowAssignerContext
in which the assigner operates.public Trigger<Object,GlobalWindow> getDefaultTrigger(StreamExecutionEnvironment env)
WindowAssigner
WindowAssigner
.getDefaultTrigger
in class WindowAssigner<Object,GlobalWindow>
public Trigger<Object,GlobalWindow> getDefaultTrigger()
WindowAssigner
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()
.
getDefaultTrigger
in class WindowAssigner<Object,GlobalWindow>
public static GlobalWindows create()
WindowAssigner
that assigns all elements to the same GlobalWindow
.
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.public static GlobalWindows createWithEndOfStreamTrigger()
WindowAssigner
that assigns all elements to the same GlobalWindow
and the window is triggered if and only if the input stream is ended.public TypeSerializer<GlobalWindow> getWindowSerializer(ExecutionConfig executionConfig)
WindowAssigner
TypeSerializer
for serializing windows that are assigned by this WindowAssigner
.getWindowSerializer
in class WindowAssigner<Object,GlobalWindow>
public boolean isEventTime()
WindowAssigner
true
if elements are assigned to windows based on event time, false
otherwise.isEventTime
in class WindowAssigner<Object,GlobalWindow>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.