private void fireTimer( TimerInternals.TimerData timer, BiConsumer<String, WindowedValue> timerConsumer) { StateNamespace namespace = timer.getNamespace(); Preconditions.checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); Instant timestamp = timer.getTimestamp(); WindowedValue<KV<Object, Timer>> timerValue = WindowedValue.of( KV.of(currentTimerKey, Timer.of(timestamp, new byte[0])), timestamp, Collections.singleton(window), PaneInfo.NO_FIRING); timerConsumer.accept(timer.getTimerId(), timerValue); }
private void fireTimer( TimerInternals.TimerData timer, BiConsumer<String, WindowedValue> timerConsumer) { StateNamespace namespace = timer.getNamespace(); Preconditions.checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); Instant timestamp = timer.getTimestamp(); WindowedValue<KV<Object, Timer>> timerValue = WindowedValue.of( KV.of(currentTimerKey, Timer.of(timestamp, new byte[0])), timestamp, Collections.singleton(window), PaneInfo.NO_FIRING); timerConsumer.accept(timer.getTimerId(), timerValue); }
@SuppressWarnings("unchecked") WindowNamespace<W> windowNamespace = (WindowNamespace<W>) timer.getNamespace(); W window = windowNamespace.getWindow();
@Override public void fireTimer(Object key, Collection<TimerData> timerDataSet) { pushbackDoFnRunner.startBundle(); @SuppressWarnings("unchecked") Coder<Object> keyCoder = (Coder) currentKeyStateInternals.getKeyCoder(); ((StateInternalsProxy) currentKeyStateInternals).setKey(key); currentKeyTimerInternals.setContext( key, keyCoder, new Instant(this.currentInputWatermark), new Instant(this.currentOutputWatermark)); for (TimerData timerData : timerDataSet) { StateNamespace namespace = timerData.getNamespace(); checkArgument(namespace instanceof WindowNamespace); BoundedWindow window = ((WindowNamespace<?>) namespace).getWindow(); pushbackDoFnRunner.onTimer( timerData.getTimerId(), window, timerData.getTimestamp(), timerData.getDomain()); } pushbackDoFnRunner.finishBundle(); }
private static <T> BoundedWindow getUnderlyingWindow(KeyedWorkItem<byte[], T> kwi) { if (Iterables.isEmpty(kwi.elementsIterable())) { // ProcessFn sets only a single timer. TimerData timer = Iterables.getOnlyElement(kwi.timersIterable()); return ((WindowNamespace) timer.getNamespace()).getWindow(); } else { // KWI must have a single element in elementsIterable, because it follows a GBK by a // uniquely generated key. // Additionally, windows must be exploded before GBKIntoKeyedWorkItems, so there's also // only a single window. WindowedValue<T> value = Iterables.getOnlyElement(kwi.elementsIterable()); return Iterables.getOnlyElement(value.getWindows()); } }
private void fireTimer(TimerInternals.TimerData timer, DoFnRunner<KV<K, V>, OutputT> doFnRunner) { StateNamespace namespace = timer.getNamespace(); checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); doFnRunner.onTimer(timer.getTimerId(), window, timer.getTimestamp(), timer.getDomain()); }
private void fireTimer(TimerInternals.TimerData timer, DoFnRunner<KV<K, V>, OutputT> doFnRunner) { StateNamespace namespace = timer.getNamespace(); checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); doFnRunner.onTimer(timer.getTimerId(), window, timer.getTimestamp(), timer.getDomain()); }
private static void advanceInputWatermark( InMemoryTimerInternals timerInternals, Instant newInputWatermark, DoFnRunner<?, ?> toTrigger) throws Exception { timerInternals.advanceInputWatermark(newInputWatermark); TimerInternals.TimerData timer; while ((timer = timerInternals.removeNextEventTimer()) != null) { StateNamespace namespace = timer.getNamespace(); checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); toTrigger.onTimer(timer.getTimerId(), window, timer.getTimestamp(), timer.getDomain()); } }
public void fireTimer(InternalTimer<?, TimerData> timer) { TimerInternals.TimerData timerData = timer.getNamespace(); StateNamespace namespace = timerData.getNamespace(); // This is a user timer, so namespace must be WindowNamespace checkArgument(namespace instanceof WindowNamespace); BoundedWindow window = ((WindowNamespace) namespace).getWindow(); pushbackDoFnRunner.onTimer(timerData.getTimerId(), window, timerData.getTimestamp(), timerData.getDomain()); }
public void fireTimer(InternalTimer<?, TimerData> timer) { TimerInternals.TimerData timerData = timer.getNamespace(); StateNamespace namespace = timerData.getNamespace(); // This is a user timer, so namespace must be WindowNamespace checkArgument(namespace instanceof WindowNamespace); BoundedWindow window = ((WindowNamespace) namespace).getWindow(); timerInternals.cleanupPendingTimer(timer.getNamespace()); pushbackDoFnRunner.onTimer( timerData.getTimerId(), window, timerData.getTimestamp(), timerData.getDomain()); }
private void fireTimer( TimerInternals.TimerData timer, DoFnRunner<KV<K, V>, OutputT> doFnRunner) { StateNamespace namespace = timer.getNamespace(); checkArgument(namespace instanceof StateNamespaces.WindowNamespace); BoundedWindow window = ((StateNamespaces.WindowNamespace) namespace).getWindow(); doFnRunner.onTimer(timer.getTimerId(), window, timer.getTimestamp(), timer.getDomain()); }
public void fireTimer(InternalTimer<?, TimerData> timer) { TimerInternals.TimerData timerData = timer.getNamespace(); StateNamespace namespace = timerData.getNamespace(); // This is a user timer, so namespace must be WindowNamespace checkArgument(namespace instanceof WindowNamespace); BoundedWindow window = ((WindowNamespace) namespace).getWindow(); timerInternals.cleanupPendingTimer(timerData); pushbackDoFnRunner.onTimer( timerData.getTimerId(), window, timerData.getTimestamp(), timerData.getDomain()); }