public class SessionWindowAssigner extends MergingWindowAssigner<TimeWindow> implements InternalTimeWindowAssigner
GroupWindowAssigner that windows elements into sessions based on the timestamp. Windows
cannot overlap.| 限定符 | 构造器和说明 |
|---|---|
protected |
SessionWindowAssigner(long sessionGap,
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. |
void |
mergeWindows(TimeWindow newWindow,
NavigableSet<TimeWindow> sortedWindows,
MergeCallback<TimeWindow,Collection<TimeWindow>> callback)
Determines which windows (if any) should be merged.
|
String |
toString() |
SessionWindowAssigner |
withEventTime() |
static SessionWindowAssigner |
withGap(Duration size)
Creates a new
SessionWindowAssigner GroupWindowAssigner that assigns elements
to sessions based on the timestamp. |
SessionWindowAssigner |
withProcessingTime() |
openpublic Collection<TimeWindow> assignWindows(org.apache.flink.table.data.RowData element, long timestamp)
GroupWindowAssignerassignWindows 在类中 GroupWindowAssigner<TimeWindow>element - The element to which windows should be assigned.timestamp - The timestamp of the element when GroupWindowAssigner.isEventTime() returns true, or
the current system time when GroupWindowAssigner.isEventTime() returns false. The timestamp value is
mapping to UTC milliseconds for splitting windows simply.public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergeCallback<TimeWindow,Collection<TimeWindow>> callback)
MergingWindowAssignermergeWindows 在类中 MergingWindowAssigner<TimeWindow>newWindow - The new windowsortedWindows - The sorted window candidates.callback - A callback that can be invoked to signal which windows should be merged.public org.apache.flink.api.common.typeutils.TypeSerializer<TimeWindow> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
GroupWindowAssignerTypeSerializer for serializing windows that are assigned by this WindowAssigner.getWindowSerializer 在类中 GroupWindowAssigner<TimeWindow>public boolean isEventTime()
GroupWindowAssignertrue if elements are assigned to windows based on event time, false
otherwise.isEventTime 在类中 GroupWindowAssigner<TimeWindow>public String toString()
toString 在类中 GroupWindowAssigner<TimeWindow>public static SessionWindowAssigner withGap(Duration size)
SessionWindowAssigner GroupWindowAssigner that assigns elements
to sessions based on the timestamp.size - The session timeout, i.e. the time gap between sessionspublic SessionWindowAssigner withEventTime()
withEventTime 在接口中 InternalTimeWindowAssignerpublic SessionWindowAssigner withProcessingTime()
withProcessingTime 在接口中 InternalTimeWindowAssignerCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.