Java Code Examples for org.apache.beam.sdk.transforms.windowing.WindowFn#isNonMerging()
The following examples show how to use
org.apache.beam.sdk.transforms.windowing.WindowFn#isNonMerging() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TriggerStateMachineTester.java From beam with Apache License 2.0 | 6 votes |
public static <W extends BoundedWindow> SimpleTriggerStateMachineTester<W> forTrigger( TriggerStateMachine stateMachine, WindowFn<Object, W> windowFn) throws Exception { ExecutableTriggerStateMachine executableTriggerStateMachine = ExecutableTriggerStateMachine.create(stateMachine); // Merging requires accumulation mode or early firings can break up a session. // Not currently an issue with the tester (because we never GC) but we don't want // mystery failures due to violating this need. AccumulationMode mode = windowFn.isNonMerging() ? AccumulationMode.DISCARDING_FIRED_PANES : AccumulationMode.ACCUMULATING_FIRED_PANES; return new SimpleTriggerStateMachineTester<>( executableTriggerStateMachine, windowFn, Duration.ZERO); }
Example 2
Source File: TriggerStateMachineTester.java From beam with Apache License 2.0 | 6 votes |
public static <InputT, W extends BoundedWindow> TriggerStateMachineTester<InputT, W> forAdvancedTrigger( TriggerStateMachine stateMachine, WindowFn<Object, W> windowFn) throws Exception { ExecutableTriggerStateMachine executableTriggerStateMachine = ExecutableTriggerStateMachine.create(stateMachine); // Merging requires accumulation mode or early firings can break up a session. // Not currently an issue with the tester (because we never GC) but we don't want // mystery failures due to violating this need. AccumulationMode mode = windowFn.isNonMerging() ? AccumulationMode.DISCARDING_FIRED_PANES : AccumulationMode.ACCUMULATING_FIRED_PANES; return new TriggerStateMachineTester<>(executableTriggerStateMachine, windowFn, Duration.ZERO); }
Example 3
Source File: TriggerStateMachineTester.java From beam with Apache License 2.0 | 6 votes |
protected TriggerStateMachineTester( ExecutableTriggerStateMachine executableTriggerStateMachine, WindowFn<Object, W> windowFn, Duration allowedLateness) throws Exception { this.windowFn = windowFn; this.executableTrigger = executableTriggerStateMachine; this.finishedSets = new HashMap<>(); this.activeWindows = windowFn.isNonMerging() ? new NonMergingActiveWindowSet<>() : new MergingActiveWindowSet<>(windowFn, stateInternals); this.windowToMergeResult = new HashMap<>(); this.contextFactory = new TriggerStateMachineContextFactory<>(windowFn, stateInternals, activeWindows); }
Example 4
Source File: WindowMergingFnRunner.java From beam with Apache License 2.0 | 5 votes |
static <T, W extends BoundedWindow> WindowMergingFnRunner<T, W> create(WindowFn<?, W> windowFn) { if (windowFn.isNonMerging()) { return new NonMergingWindowFnRunner(); } else { return new MergingViaWindowFnRunner(windowFn); } }
Example 5
Source File: GroupByKey.java From beam with Apache License 2.0 | 5 votes |
public WindowingStrategy<?, ?> updateWindowingStrategy(WindowingStrategy<?, ?> inputStrategy) { WindowFn<?, ?> inputWindowFn = inputStrategy.getWindowFn(); if (!inputWindowFn.isNonMerging()) { // Prevent merging windows again, without explicit user // involvement, e.g., by Window.into() or Window.remerge(). inputWindowFn = new InvalidWindows<>( "WindowFn has already been consumed by previous GroupByKey", inputWindowFn); } // We also switch to the continuation trigger associated with the current trigger. return inputStrategy .withWindowFn(inputWindowFn) .withTrigger(inputStrategy.getTrigger().getContinuationTrigger()); }