Class SessionWindowAssigner
java.lang.Object
org.apache.flink.table.runtime.operators.window.groupwindow.assigners.GroupWindowAssigner<W>
org.apache.flink.table.runtime.operators.window.groupwindow.assigners.MergingWindowAssigner<TimeWindow>
org.apache.flink.table.runtime.operators.window.groupwindow.assigners.SessionWindowAssigner
- All Implemented Interfaces:
Serializable,InternalTimeWindowAssigner
public class SessionWindowAssigner
extends MergingWindowAssigner<TimeWindow>
implements InternalTimeWindowAssigner
A
GroupWindowAssigner that windows elements into sessions based on the timestamp. Windows
cannot overlap.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSessionWindowAssigner(long sessionGap, boolean isEventTime) -
Method Summary
Modifier and TypeMethodDescriptionassignWindows(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 aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner.booleanReturnstrueif elements are assigned to windows based on event time,falseotherwise.voidmergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergeCallback<TimeWindow, Collection<TimeWindow>> callback) Determines which windows (if any) should be merged.toString()static SessionWindowAssignerCreates a newSessionWindowAssignerGroupWindowAssignerthat assigns elements to sessions based on the timestamp.Methods inherited from class org.apache.flink.table.runtime.operators.window.groupwindow.assigners.GroupWindowAssigner
open
-
Constructor Details
-
SessionWindowAssigner
protected SessionWindowAssigner(long sessionGap, boolean isEventTime)
-
-
Method Details
-
assignWindows
public Collection<TimeWindow> assignWindows(org.apache.flink.table.data.RowData element, long timestamp) Description copied from class:GroupWindowAssignerGiven the timestamp and element, returns the set of windows into which it should be placed.- Specified by:
assignWindowsin classGroupWindowAssigner<TimeWindow>- Parameters:
element- The element to which windows should be assigned.timestamp- The timestamp of the element whenGroupWindowAssigner.isEventTime()returns true, or the current system time whenGroupWindowAssigner.isEventTime()returns false. The timestamp value is mapping to UTC milliseconds for splitting windows simply.
-
getWindowSerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<TimeWindow> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig) Description copied from class:GroupWindowAssignerReturns aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner.- Specified by:
getWindowSerializerin classGroupWindowAssigner<TimeWindow>
-
isEventTime
public boolean isEventTime()Description copied from class:GroupWindowAssignerReturnstrueif elements are assigned to windows based on event time,falseotherwise.- Specified by:
isEventTimein classGroupWindowAssigner<TimeWindow>
-
toString
- Specified by:
toStringin classGroupWindowAssigner<TimeWindow>
-
withGap
Creates a newSessionWindowAssignerGroupWindowAssignerthat assigns elements to sessions based on the timestamp.- Parameters:
size- The session timeout, i.e. the time gap between sessions- Returns:
- The policy.
-
withEventTime
- Specified by:
withEventTimein interfaceInternalTimeWindowAssigner- Returns:
- an InternalTimeWindowAssigner which in event time mode.
-
withProcessingTime
- Specified by:
withProcessingTimein interfaceInternalTimeWindowAssigner- Returns:
- an InternalTimeWindowAssigner which in processing time mode.
-