public class TumblingWindowAssigner extends WindowAssigner<TimeWindow> implements InternalTimeWindowAssigner
WindowAssigner that windows elements into fixed-size windows based on the timestamp of
the elements. Windows cannot overlap.| 限定符 | 构造器和说明 |
|---|---|
protected |
TumblingWindowAssigner(long size,
long offset,
boolean isEventTime) |
| 限定符和类型 | 方法和说明 |
|---|---|
Collection<TimeWindow> |
assignWindows(org.apache.flink.table.data.RowData element,
long timestamp)
Given the timestamp and element, returns the set of windows into which it should be placed.
|
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 TumblingWindowAssigner |
of(java.time.Duration size)
Creates a new
TumblingWindowAssigner WindowAssigner that assigns elements to
time windows based on the element timestamp. |
String |
toString() |
TumblingWindowAssigner |
withEventTime() |
TumblingWindowAssigner |
withOffset(java.time.Duration offset)
Creates a new
TumblingWindowAssigner WindowAssigner that assigns elements to
time windows based on the element timestamp and offset. |
TumblingWindowAssigner |
withProcessingTime() |
openprotected TumblingWindowAssigner(long size,
long offset,
boolean isEventTime)
public Collection<TimeWindow> assignWindows(org.apache.flink.table.data.RowData element, long timestamp)
WindowAssignerassignWindows 在类中 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. The timestamp value is
mapping to UTC milliseconds for splitting windows simply.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 在类中 WindowAssigner<TimeWindow>public boolean isEventTime()
WindowAssignertrue if elements are assigned to windows based on event time, false
otherwise.isEventTime 在类中 WindowAssigner<TimeWindow>public String toString()
toString 在类中 WindowAssigner<TimeWindow>public static TumblingWindowAssigner of(java.time.Duration size)
TumblingWindowAssigner WindowAssigner that assigns elements to
time windows based on the element timestamp.size - The size of the generated windows.public TumblingWindowAssigner withOffset(java.time.Duration offset)
TumblingWindowAssigner WindowAssigner that assigns elements to
time windows based on the element timestamp and offset.
For example, if you want window a stream by hour,but window begins at the 15th minutes of
each hour, you can use of(Time.hours(1),Time.minutes(15)),then you will get time
windows start at 0:15:00,1:15:00,2:15:00,etc.
Rather than that,if you are living in somewhere which is not using UTC±00:00 time, such as
China which is using GMT+08:00,and you want a time window with size of one day, and window
begins at every 00:00:00 of local time,you may use of(Time.days(1),Time.hours(-8)).
The parameter of offset is Time.hours(-8)) since UTC+08:00 is 8 hours earlier than
UTC time.
offset - The offset which window start would be shifted by.public TumblingWindowAssigner withEventTime()
withEventTime 在接口中 InternalTimeWindowAssignerpublic TumblingWindowAssigner withProcessingTime()
withProcessingTime 在接口中 InternalTimeWindowAssignerCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.