Class SessionWindowAssigner
- java.lang.Object
-
- org.apache.flink.table.runtime.operators.window.assigners.WindowAssigner<W>
-
- org.apache.flink.table.runtime.operators.window.assigners.MergingWindowAssigner<TimeWindow>
-
- org.apache.flink.table.runtime.operators.window.assigners.SessionWindowAssigner
-
- All Implemented Interfaces:
Serializable,InternalTimeWindowAssigner
public class SessionWindowAssigner extends MergingWindowAssigner<TimeWindow> implements InternalTimeWindowAssigner
AWindowAssignerthat windows elements into sessions based on the timestamp. Windows cannot overlap.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.table.runtime.operators.window.assigners.MergingWindowAssigner
MergingWindowAssigner.MergeCallback<W>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSessionWindowAssigner(long sessionGap, boolean isEventTime)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner.booleanisEventTime()Returnstrueif elements are assigned to windows based on event time,falseotherwise.voidmergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergingWindowAssigner.MergeCallback<TimeWindow> callback)Determines which windows (if any) should be merged.StringtoString()SessionWindowAssignerwithEventTime()static SessionWindowAssignerwithGap(java.time.Duration size)Creates a newSessionWindowAssignerWindowAssignerthat assigns elements to sessions based on the timestamp.SessionWindowAssignerwithProcessingTime()-
Methods inherited from class org.apache.flink.table.runtime.operators.window.assigners.WindowAssigner
open
-
-
-
-
Method Detail
-
assignWindows
public Collection<TimeWindow> assignWindows(org.apache.flink.table.data.RowData element, long timestamp)
Description copied from class:WindowAssignerGiven the timestamp and element, returns the set of windows into which it should be placed.- Specified by:
assignWindowsin classWindowAssigner<TimeWindow>- Parameters:
element- The element to which windows should be assigned.timestamp- The timestamp of the element whenWindowAssigner.isEventTime()returns true, or the current system time whenWindowAssigner.isEventTime()returns false. The timestamp value is mapping to UTC milliseconds for splitting windows simply.
-
mergeWindows
public void mergeWindows(TimeWindow newWindow, NavigableSet<TimeWindow> sortedWindows, MergingWindowAssigner.MergeCallback<TimeWindow> callback)
Description copied from class:MergingWindowAssignerDetermines which windows (if any) should be merged.- Specified by:
mergeWindowsin classMergingWindowAssigner<TimeWindow>- Parameters:
newWindow- The new windowsortedWindows- The sorted window candidates.callback- A callback that can be invoked to signal which windows should be merged.
-
getWindowSerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<TimeWindow> getWindowSerializer(org.apache.flink.api.common.ExecutionConfig executionConfig)
Description copied from class:WindowAssignerReturns aTypeSerializerfor serializing windows that are assigned by thisWindowAssigner.- Specified by:
getWindowSerializerin classWindowAssigner<TimeWindow>
-
isEventTime
public boolean isEventTime()
Description copied from class:WindowAssignerReturnstrueif elements are assigned to windows based on event time,falseotherwise.- Specified by:
isEventTimein classWindowAssigner<TimeWindow>
-
toString
public String toString()
- Specified by:
toStringin classWindowAssigner<TimeWindow>
-
withGap
public static SessionWindowAssigner withGap(java.time.Duration size)
Creates a newSessionWindowAssignerWindowAssignerthat assigns elements to sessions based on the timestamp.- Parameters:
size- The session timeout, i.e. the time gap between sessions- Returns:
- The policy.
-
withEventTime
public SessionWindowAssigner withEventTime()
- Specified by:
withEventTimein interfaceInternalTimeWindowAssigner- Returns:
- an InternalTimeWindowAssigner which in event time mode.
-
withProcessingTime
public SessionWindowAssigner withProcessingTime()
- Specified by:
withProcessingTimein interfaceInternalTimeWindowAssigner- Returns:
- an InternalTimeWindowAssigner which in processing time mode.
-
-