Class WindowUtils
java.lang.Object
org.apache.flink.datastream.impl.extension.window.utils.WindowUtils
Utilities for Window extension.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?,?> createWindowAssigner(org.apache.flink.datastream.api.extension.window.strategy.WindowStrategy windowStrategy) Create aWindowAssigneraccording toWindowStrategy.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
voiddeleteCleanupTimer(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, WindowTriggerContext<?, ?, W> triggerContext, long allowedLateness) Deletes the cleanup timer set for the contents of the provided window.static longgetAllowedLateness(org.apache.flink.datastream.api.extension.window.strategy.WindowStrategy windowStrategy) Get the allowed lateness for the window.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
booleanisCleanupTime(W window, long time, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, long allowedLateness) Returnstrueif the given time is the cleanup time for the given window.static booleanisElementLate(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> element, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, long allowedLateness, org.apache.flink.streaming.api.operators.InternalTimerService<?> internalTimerService) Decide if a record is currently late, based on current event time and allowed lateness.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
booleanisWindowLate(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, W> windowAssigner, org.apache.flink.streaming.api.operators.InternalTimerService<W> internalTimerService, long allowedLateness) Returnstrueif the event time is after the end timestamp plus the allowed lateness of the given window.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
voidregisterCleanupTimer(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, WindowTriggerContext<?, ?, W> triggerContext, long allowedLateness) Registers a timer to cleanup the content of the window.
-
Constructor Details
-
WindowUtils
public WindowUtils()
-
-
Method Details
-
getAllowedLateness
public static long getAllowedLateness(org.apache.flink.datastream.api.extension.window.strategy.WindowStrategy windowStrategy) Get the allowed lateness for the window. Note that, in the current design, only TumblingTimeWindow and SlidingTimeWindow can have allowed lateness configured; for other types of windows, the returned allowed lateness will be 0. -
createWindowAssigner
public static org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?,?> createWindowAssigner(org.apache.flink.datastream.api.extension.window.strategy.WindowStrategy windowStrategy) Create aWindowAssigneraccording toWindowStrategy. -
isWindowLate
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> boolean isWindowLate(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, W> windowAssigner, org.apache.flink.streaming.api.operators.InternalTimerService<W> internalTimerService, long allowedLateness) Returnstrueif the event time is after the end timestamp plus the allowed lateness of the given window. -
isElementLate
public static boolean isElementLate(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<?> element, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, long allowedLateness, org.apache.flink.streaming.api.operators.InternalTimerService<?> internalTimerService) Decide if a record is currently late, based on current event time and allowed lateness.- Parameters:
element- The element to checkwindowAssigner- The window assignerallowedLateness- The allowed lateness of the windowinternalTimerService- The timer service to get current event time- Returns:
- The element for which should be considered late
-
deleteCleanupTimer
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> void deleteCleanupTimer(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, WindowTriggerContext<?, ?, W> triggerContext, long allowedLateness) Deletes the cleanup timer set for the contents of the provided window.- Parameters:
window- the window whose state to discardwindowAssigner- The window assignertriggerContext- The trigger contextallowedLateness- The allowed lateness of the window
-
registerCleanupTimer
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> void registerCleanupTimer(W window, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, WindowTriggerContext<?, ?, W> triggerContext, long allowedLateness) Registers a timer to cleanup the content of the window.- Parameters:
window- the window whose state to discardwindowAssigner- The window assignertriggerContext- The trigger contextallowedLateness- The allowed lateness of the window
-
isCleanupTime
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> boolean isCleanupTime(W window, long time, org.apache.flink.streaming.api.windowing.assigners.WindowAssigner<?, ?> windowAssigner, long allowedLateness) Returnstrueif the given time is the cleanup time for the given window.
-