public override void Clear(TWindow window, IWindowTriggerContext ctx) => NestedTrigger.Clear(window, ctx);
public override void Clear(TWindow window, IWindowTriggerContext ctx) => ctx.GetPartitionedState(_stateDesc).Clear();
public override WindowTriggerResult OnElement(TElement element, long timestamp, TWindow window, IWindowTriggerContext ctx) { var count = ctx.GetPartitionedState(_stateDesc); count.Add(1L); if (count.Get() < Limit) { return(WindowTriggerResult.Continue); } count.Clear(); return(WindowTriggerResult.Fire); }
public override WindowTriggerResult OnEventTime(long time, TimeWindow window, IWindowTriggerContext ctx) => WindowTriggerResult.Continue;
public override WindowTriggerResult OnProcessingTime(long time, TWindow window, IWindowTriggerContext ctx) { throw new NotImplementedException(); }
public override WindowTriggerResult OnElement(TElement element, long timestamp, TWindow window, IWindowTriggerContext ctx) { throw new System.NotImplementedException(); }
public override WindowTriggerResult OnEventTime(long time, TWindow window, IWindowTriggerContext ctx) { throw new System.NotImplementedException(); }
/// <summary> /// Called when an event-time timer that was set using the trigger context fires. /// Note: This method is not called in case the window does not contain any elements. /// </summary> /// <param name="time">The timestamp at which the timer fired.</param> /// <param name="window">The window for which the timer fired.</param> /// <param name="ctx">A context object that can be used to register timer callbacks.</param> /// <returns>the triggered result.</returns> public abstract WindowTriggerResult OnEventTime(long time, TWindow window, IWindowTriggerContext ctx);
/// <summary> /// Clears any state that the trigger might still hold for the given window. This is called when a window is purged. /// </summary> /// <param name="window"></param> /// <param name="ctx"></param> public abstract void Clear(TWindow window, IWindowTriggerContext ctx);
/// <summary> /// Called for every element that gets added to a pane. The result of this will determine whether the pane is evaluated to emit results. /// This method is not called in case the window does not contain any elements. /// </summary> /// <param name="element">The element that arrived.</param> /// <param name="timestamp">The timestamp of the element that arrived.</param> /// <param name="window">The window to which the element is being added.</param> /// <param name="ctx">A context object that can be used to register timer callbacks.</param> /// <returns>the triggered result.</returns> public abstract WindowTriggerResult OnElement(TElement element, long timestamp, TWindow window, IWindowTriggerContext ctx);
/// <summary> /// Called when a processing-time timer that was set using the trigger context fires. /// This method is not called in case the window does not contain any elements. /// </summary> /// <param name="time">The timestamp at which the timer fired.</param> /// <param name="window">The window for which the timer fired.</param> /// <param name="ctx">A context object that can be used to register timer callbacks.</param> /// <returns>the triggered result.</returns> public abstract WindowTriggerResult OnProcessingTime(long time, TWindow window, IWindowTriggerContext ctx);
public override WindowTriggerResult OnEventTime(long time, TimeWindow window, IWindowTriggerContext ctx) => time == window.MaxTimestamp ? WindowTriggerResult.Fire : WindowTriggerResult.Continue;
public override WindowTriggerResult OnElement(TElement element, long timestamp, TimeWindow window, IWindowTriggerContext ctx) { // if the watermark is already past the window fire immediately if (window.MaxTimestamp <= ctx.CurrentWatermark) { return(WindowTriggerResult.Fire); } ctx.RegisterEventTimeTimer(window.MaxTimestamp); return(WindowTriggerResult.Continue); }
public override void Clear(TimeWindow window, IWindowTriggerContext ctx) => ctx.DeleteEventTimeTimer(window.MaxTimestamp);
public override WindowTriggerResult OnElement(TElement element, long timestamp, TWindow window, IWindowTriggerContext ctx) { var triggerResult = NestedTrigger.OnElement(element, timestamp, window, ctx); return(triggerResult.IsFire ? WindowTriggerResult.FireAndPurge : triggerResult); }
public override WindowTriggerResult OnElement(TElement element, long timestamp, GlobalWindow window, IWindowTriggerContext ctx) { return(WindowTriggerResult.Continue); }
public override WindowTriggerResult OnProcessingTime(long time, TWindow window, IWindowTriggerContext ctx) { var triggerResult = NestedTrigger.OnProcessingTime(time, window, ctx); return(triggerResult.IsFire ? WindowTriggerResult.FireAndPurge : triggerResult); }
public override WindowTriggerResult OnEventTime(long time, GlobalWindow window, IWindowTriggerContext ctx) { return(WindowTriggerResult.Continue); }
public override WindowTriggerResult OnProcessingTime(long time, TWindow window, IWindowTriggerContext ctx) => WindowTriggerResult.Continue;
public override WindowTriggerResult OnElement(TElement element, long timestamp, TWindow window, IWindowTriggerContext ctx) { var lastElementState = ctx.GetPartitionedState(_stateDesc); if (lastElementState.Value == null) { lastElementState.Value = element; return(WindowTriggerResult.Continue); } if (DeltaFunction.GetDelta(lastElementState.Value, element) <= Threshold) { return(WindowTriggerResult.Continue); } lastElementState.Value = element; return(WindowTriggerResult.Fire); }
public override void Clear(TWindow window, IWindowTriggerContext ctx) { throw new System.NotImplementedException(); }
public override WindowTriggerResult OnElement(TElement element, long timestamp, TimeWindow window, IWindowTriggerContext ctx) { ctx.RegisterProcessingTimeTimer(window.MaxTimestamp); return(WindowTriggerResult.Continue); }