public class SlidingWindowAssigner extends PanedWindowAssigner<TimeWindow> implements InternalTimeWindowAssigner
WindowAssigner that windows elements into sliding windows based on the timestamp of the
elements. Windows can possibly overlap.| Modifier | Constructor and Description |
|---|---|
protected |
SlidingWindowAssigner(long size,
long slide,
long offset,
boolean isEventTime) |
| Modifier and Type | Method and Description |
|---|---|
TimeWindow |
assignPane(Object element,
long timestamp)
Given the timestamp and element, returns the pane into which it should be placed.
|
Collection<TimeWindow> |
assignWindows(BaseRow element,
long timestamp)
Given the timestamp and element, returns the set of windows into which it
should be placed.
|
TimeWindow |
getLastWindow(TimeWindow pane)
Gets the last window which the pane belongs to.
|
org.apache.flink.api.common.typeutils.TypeSerializer<TimeWindow> |
getWindowSerializer(org.apache.flink.api.common.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. |
static SlidingWindowAssigner |
of(java.time.Duration size,
java.time.Duration slide)
Creates a new
SlidingEventTimeWindows org.apache.flink.streaming.api.windowing.assigners.WindowAssigner that assigns
elements to sliding time windows based on the element timestamp. |
Iterable<TimeWindow> |
splitIntoPanes(TimeWindow window)
Splits the given window into panes collection.
|
String |
toString() |
SlidingWindowAssigner |
withEventTime() |
SlidingWindowAssigner |
withOffset(java.time.Duration offset) |
SlidingWindowAssigner |
withProcessingTime() |
openprotected SlidingWindowAssigner(long size,
long slide,
long offset,
boolean isEventTime)
public Collection<TimeWindow> assignWindows(BaseRow element, long timestamp)
WindowAssignerassignWindows in class WindowAssigner<TimeWindow>element - The element to which windows should be assigned.timestamp - The timestamp of the element when WindowAssigner.isEventTime() returns true,
or the current system time when WindowAssigner.isEventTime() returns false.public TimeWindow assignPane(Object element, long timestamp)
PanedWindowAssignerassignPane in class PanedWindowAssigner<TimeWindow>element - The element to which windows should be assigned.timestamp - The timestamp of the element when WindowAssigner.isEventTime() returns true,
or the current system time when WindowAssigner.isEventTime() returns false.public Iterable<TimeWindow> splitIntoPanes(TimeWindow window)
PanedWindowAssignersplitIntoPanes in class PanedWindowAssigner<TimeWindow>window - the window to be split.public TimeWindow getLastWindow(TimeWindow pane)
PanedWindowAssignergetLastWindow in class PanedWindowAssigner<TimeWindow>public org.apache.flink.api.common.typeutils.TypeSerializer<TimeWindow> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
WindowAssignerTypeSerializer for serializing windows that are assigned by
this WindowAssigner.getWindowSerializer in class WindowAssigner<TimeWindow>public boolean isEventTime()
WindowAssignertrue if elements are assigned to windows based on event time,
false otherwise.isEventTime in class WindowAssigner<TimeWindow>public String toString()
toString in class WindowAssigner<TimeWindow>public static SlidingWindowAssigner of(java.time.Duration size, java.time.Duration slide)
SlidingEventTimeWindows org.apache.flink.streaming.api.windowing.assigners.WindowAssigner that assigns
elements to sliding time windows based on the element timestamp.size - The size of the generated windows.slide - The slide interval of the generated windows.public SlidingWindowAssigner withOffset(java.time.Duration offset)
public SlidingWindowAssigner withEventTime()
withEventTime in interface InternalTimeWindowAssignerpublic SlidingWindowAssigner withProcessingTime()
withProcessingTime in interface InternalTimeWindowAssignerCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.