Search in sources :

Example 1 with AssignWindowsFunction

use of org.apache.beam.runners.twister2.translators.functions.AssignWindowsFunction in project beam by apache.

the class AssignWindowTranslatorBatch method translateNode.

@Override
public void translateNode(Window.Assign<T> transform, Twister2BatchTranslationContext context) {
    BatchTSetImpl<WindowedValue<T>> inputTTSet = context.getInputDataSet(context.getInput(transform));
    final WindowingStrategy<T, BoundedWindow> windowingStrategy = (WindowingStrategy<T, BoundedWindow>) context.getOutput(transform).getWindowingStrategy();
    WindowFn<T, BoundedWindow> windowFn = windowingStrategy.getWindowFn();
    ComputeTSet<WindowedValue<T>, Iterator<WindowedValue<T>>> outputTSet = inputTTSet.direct().compute(new AssignWindowsFunction(windowFn, context.getOptions()));
    context.setOutputDataSet(context.getOutput(transform), outputTSet);
}
Also used : AssignWindowsFunction(org.apache.beam.runners.twister2.translators.functions.AssignWindowsFunction) WindowedValue(org.apache.beam.sdk.util.WindowedValue) Iterator(java.util.Iterator) BoundedWindow(org.apache.beam.sdk.transforms.windowing.BoundedWindow) WindowingStrategy(org.apache.beam.sdk.values.WindowingStrategy)

Aggregations

Iterator (java.util.Iterator)1 AssignWindowsFunction (org.apache.beam.runners.twister2.translators.functions.AssignWindowsFunction)1 BoundedWindow (org.apache.beam.sdk.transforms.windowing.BoundedWindow)1 WindowedValue (org.apache.beam.sdk.util.WindowedValue)1 WindowingStrategy (org.apache.beam.sdk.values.WindowingStrategy)1