T
- The type of elements that this WindowAssigner can assign windows to.W
- The type of Window
that this assigner assigns.@PublicEvolving public abstract class WindowAssigner<T,W extends Window> extends Object implements Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
WindowAssigner.WindowAssignerContext
A context provided to the
WindowAssigner that allows it to query the current
processing time. |
Constructor and Description |
---|
WindowAssigner() |
Modifier and Type | Method and Description |
---|---|
abstract Collection<W> |
assignWindows(T element,
long timestamp,
WindowAssigner.WindowAssignerContext context)
Returns a
Collection of windows that should be assigned to the element. |
Trigger<T,W> |
getDefaultTrigger()
Returns the default trigger associated with this
WindowAssigner . |
abstract Trigger<T,W> |
getDefaultTrigger(StreamExecutionEnvironment env)
Deprecated.
the method is deprecated since Flink 1.19 because
StreamExecutionEnvironment is unused. Please use getDefaultTrigger and override
this method with an empty body instead. 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() . |
abstract TypeSerializer<W> |
getWindowSerializer(ExecutionConfig executionConfig)
Returns a
TypeSerializer for serializing windows that are assigned by this WindowAssigner . |
abstract boolean |
isEventTime()
Returns
true if elements are assigned to windows based on event time, false
otherwise. |
public abstract Collection<W> assignWindows(T element, long timestamp, WindowAssigner.WindowAssignerContext context)
Collection
of windows that should be assigned to the element.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<T,W> getDefaultTrigger()
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()
.
@Deprecated public abstract Trigger<T,W> getDefaultTrigger(StreamExecutionEnvironment env)
StreamExecutionEnvironment
is unused. Please use getDefaultTrigger
and override
this method with an empty body instead. 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()
.WindowAssigner
.public abstract TypeSerializer<W> getWindowSerializer(ExecutionConfig executionConfig)
TypeSerializer
for serializing windows that are assigned by this WindowAssigner
.public abstract boolean isEventTime()
true
if elements are assigned to windows based on event time, false
otherwise.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.