def on_event_time(self, time: int, window: TimeWindow, ctx: 'Trigger.TriggerContext') -> TriggerResult: if time >= window.max_timestamp(): return TriggerResult.FIRE_AND_PURGE else: return TriggerResult.CONTINUE
def merge_windows(self, windows, callback: 'MergingWindowAssigner.MergeCallback[TimeWindow]') -> None: window_list = [w for w in windows] window_list.sort() for i in range(1, len(window_list)): if window_list[i - 1].end > window_list[i].start: callback.merge([window_list[i - 1], window_list[i]], TimeWindow(window_list[i - 1].start, window_list[i].end))
def assign_windows(self, element: tuple, timestamp: int, context): return [TimeWindow(timestamp, timestamp + 5)]
def to_internal(self, value) -> TimeWindow: return TimeWindow(value.getStart(), value.getEnd())