@PublicEvolving public class TumblingEventTimeWindows extends WindowAssigner<Object,TimeWindow>
WindowAssigner that windows elements into windows based on the timestamp of the
elements. Windows cannot overlap.
For example, in order to window into windows of 1 minute:
DataStream<Tuple2<String, Integer>> in = ...;
KeyedStream<Tuple2<String, Integer>, String> keyed = in.keyBy(...);
WindowedStream<Tuple2<String, Integer>, String, TimeWindow> windowed =
keyed.window(TumblingEventTimeWindows.of(Time.minutes(1)));
WindowAssigner.WindowAssignerContext| Modifier | Constructor and Description |
|---|---|
protected |
TumblingEventTimeWindows(long size) |
| Modifier and Type | Method and Description |
|---|---|
Collection<TimeWindow> |
assignWindows(Object element,
long timestamp,
WindowAssigner.WindowAssignerContext context)
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() |
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 TumblingEventTimeWindows |
of(Time size)
Creates a new
TumblingEventTimeWindows WindowAssigner that assigns
elements to time windows based on the element timestamp. |
String |
toString() |
public Collection<TimeWindow> assignWindows(Object element, long timestamp, WindowAssigner.WindowAssignerContext context)
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.context - The WindowAssigner.WindowAssignerContext in which the assigner operates.public long getSize()
public Trigger<Object,TimeWindow> getDefaultTrigger(StreamExecutionEnvironment env)
WindowAssignerWindowAssigner.getDefaultTrigger in class WindowAssigner<Object,TimeWindow>public static TumblingEventTimeWindows of(Time size)
TumblingEventTimeWindows WindowAssigner that assigns
elements to time windows based on the element timestamp.size - The size 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>public boolean isEventTime()
WindowAssignertrue if elements are assigned to windows based on event time,
false otherwise.isEventTime in class WindowAssigner<Object,TimeWindow>Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.