public class SlidingProcessingTimeWindows extends WindowAssigner<Object,TimeWindow>
WindowAssigner that windows elements into sliding windows based on the current
system time of the machine the operation is running on. Windows can possibly overlap.
For example, in order to window into windows of 1 minute, every 10 seconds:
DataStream<Tuple2<String, Integer>> in = ...;
KeyedStream<String, Tuple2<String, Integer>> keyed = in.keyBy(...);
WindowedStream<Tuple2<String, Integer>, String, TimeWindows> windowed =
keyed.window(SlidingProcessingTimeWindows.of(Time.of(1, MINUTES), Time.of(10, SECONDS));
| Modifier and Type | Method and Description |
|---|---|
Collection<TimeWindow> |
assignWindows(Object element,
long timestamp)
Returns a
Collection of windows that should be assigned to the element. |
Trigger<Object,TimeWindow> |
getDefaultTrigger(StreamExecutionEnvironment env)
Returns the default trigger associated with this
WindowAssigner. |
long |
getSize() |
long |
getSlide() |
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. |
static SlidingProcessingTimeWindows |
of(Time size,
Time slide)
Creates a new
SlidingProcessingTimeWindows WindowAssigner that assigns
elements to sliding time windows based on the element timestamp. |
String |
toString() |
public Collection<TimeWindow> assignWindows(Object element, long timestamp)
WindowAssignerCollection of windows that should be assigned to the element.assignWindows in class WindowAssigner<Object,TimeWindow>element - The element to which windows should be assigned.timestamp - The timestamp of the element.public long getSize()
public long getSlide()
public Trigger<Object,TimeWindow> getDefaultTrigger(StreamExecutionEnvironment env)
WindowAssignerWindowAssigner.getDefaultTrigger in class WindowAssigner<Object,TimeWindow>public static SlidingProcessingTimeWindows of(Time size, Time slide)
SlidingProcessingTimeWindows 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 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<Object,TimeWindow>Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.