public class SessionWindowAssigner extends MergingWindowAssigner<TimeWindow> implements InternalTimeWindowAssigner
WindowAssigner that windows elements into sessions based on the timestamp.
Windows cannot overlap.MergingWindowAssigner.MergeCallback<W>| 限定符 | 构造器和说明 |
|---|---|
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,
MergingWindowAssigner.MergeCallback<TimeWindow> callback)
Determines which windows (if any) should be merged.
|
String |
toString() |
SessionWindowAssigner |
withEventTime() |
static SessionWindowAssigner |
withGap(java.time.Duration size)
Creates a new
SessionWindowAssigner WindowAssigner that assigns
elements to sessions based on the timestamp. |
SessionWindowAssigner |
withProcessingTime() |
openpublic 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.public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergingWindowAssigner.MergeCallback<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)
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 SessionWindowAssigner withGap(java.time.Duration size)
SessionWindowAssigner WindowAssigner 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–2020 The Apache Software Foundation. All rights reserved.