use of org.apache.beam.sdk.transforms.windowing.Sessions in project beam by apache.
the class FlinkReduceFunction method reduce.
@Override
public void reduce(Iterable<WindowedValue<KV<K, AccumT>>> elements, Collector<WindowedValue<KV<K, OutputT>>> out) throws Exception {
PipelineOptions options = serializedOptions.get();
FlinkSideInputReader sideInputReader = new FlinkSideInputReader(sideInputs, getRuntimeContext());
AbstractFlinkCombineRunner<K, AccumT, AccumT, OutputT, W> reduceRunner;
if (groupedByWindow) {
reduceRunner = new SingleWindowFlinkCombineRunner<>();
} else {
if (windowingStrategy.needsMerge() && windowingStrategy.getWindowFn() instanceof Sessions) {
reduceRunner = new SortingFlinkCombineRunner<>();
} else {
reduceRunner = new HashingFlinkCombineRunner<>();
}
}
reduceRunner.combine(new AbstractFlinkCombineRunner.FinalFlinkCombiner<>(combineFn), windowingStrategy, sideInputReader, options, elements, out);
}
Aggregations