Created
June 5, 2018 22:34
-
-
Save davideanastasia/ae58b2bb74ffa2c340945c3846870931 to your computer and use it in GitHub Desktop.
Apache Beam Getting Started - #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ReduceFn extends Combine.CombineFn<Metadata, Index, Index> { | |
| @Override | |
| public Index createAccumulator() { | |
| return new Index(); | |
| } | |
| @Override | |
| public Index addInput(Index accumulator, Metadata input) { | |
| accumulator.add(input); | |
| return accumulator; | |
| } | |
| @Override | |
| public Index mergeAccumulators(Iterable<Index> accumulators) { | |
| Index accum = new Index(); | |
| for (Index currentAccum : accumulators) { | |
| accum.add(currentAccum); | |
| } | |
| return accum; | |
| } | |
| @Override | |
| public Index extractOutput(Index accumulator) { | |
| return accumulator; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment