/** * Check whether invoke startBundle, if it is, need to output elements that were buffered as part * of finishing a bundle in snapshot() first. * * <p>In order to avoid having {@link DoFnRunner#processElement(WindowedValue)} or {@link * DoFnRunner#onTimer(String, BoundedWindow, Instant, TimeDomain)} not between StartBundle and * FinishBundle, this method needs to be called in each processElement and each processWatermark * and onProcessingTime. Do not need to call in onEventTime, because it has been guaranteed in the * processWatermark. */ private void checkInvokeStartBundle() { if (!bundleStarted) { outputManager.flushBuffer(); pushbackDoFnRunner.startBundle(); bundleStarted = true; } }
/** * Check whether invoke startBundle, if it is, need to output elements that were buffered as part * of finishing a bundle in snapshot() first. * * <p>In order to avoid having {@link DoFnRunner#processElement(WindowedValue)} or {@link * DoFnRunner#onTimer(String, BoundedWindow, Instant, TimeDomain)} not between StartBundle and * FinishBundle, this method needs to be called in each processElement and each processWatermark * and onProcessingTime. Do not need to call in onEventTime, because it has been guaranteed in the * processWatermark. */ private void checkInvokeStartBundle() { if (!bundleStarted) { outputManager.flushBuffer(); pushbackDoFnRunner.startBundle(); bundleStarted = true; } }
/** * Check whether invoke startBundle, if it is, need to output elements that were * buffered as part of finishing a bundle in snapshot() first. * * <p>In order to avoid having {@link DoFnRunner#processElement(WindowedValue)} or * {@link DoFnRunner#onTimer(String, BoundedWindow, Instant, TimeDomain)} not between * StartBundle and FinishBundle, this method needs to be called in each processElement * and each processWatermark and onProcessingTime. Do not need to call in onEventTime, * because it has been guaranteed in the processWatermark. */ private void checkInvokeStartBundle() { if (!bundleStarted) { outputManager.flushBuffer(); pushbackDoFnRunner.startBundle(); bundleStarted = true; } }
/** * Checks whether the bundle is finished or not. * Starts the bundle if it is done. * * TODO #263: Partial Combining for Beam Streaming * We may want to use separate methods for doFnRunner/pushBackRunner * (same applies to the other bundle-related methods) */ final void checkAndInvokeBundle() { if (bundleFinished) { bundleFinished = false; if (pushBackRunner == null) { doFnRunner.startBundle(); } else { pushBackRunner.startBundle(); } prevBundleStartTime = System.currentTimeMillis(); currBundleCount = 0; } currBundleCount += 1; }
outputManager.clear(); doFnRunner.startBundle();
@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 Iterable<WindowedValue<InputT>> processElementInReadyWindows(WindowedValue<InputT> elem) { try { pushbackDoFnRunner.startBundle(); if (currentKeyStateInternals != null) { InputT value = elem.getValue();