... .apply(GroupByKey.<String, Integer>create()) .apply( ParDo.named("MySum") .of( new DoFn<KV<String, Iterable<Integer>>, KV<String, Integer>>() { @Override public void processElement(ProcessContext c) { String key = c.element().getKey(); int summedValue = 0; for (int i : c.element().getValue()) { summedValue += i; } c.output(KV.of(key, summedValue)); } })) ...
... .apply(GroupByKey.<String, Integer>create()) .apply("MySum", Combine.<String,Integer>groupedValues( new SerializableFunction<Iterable<Integer>, Integer>() { @Override public Integer apply(Iterable<Integer> values) { int summedValue = 0; for (int i : values) { summedValue += i; } return summedValue; } })) ...
.apply(GroupByKey.<String, Integer>create()) .apply("MySum", Combine.<String,Integer>groupedValues( new SerializableFunction<Iterable<Integer>, Integer>() { @Override public Integer apply(Iterable<Integer> values) { int summedValue = 0; for (int i : values) { summedValue += i; } return summedValue; } })) ...
0 件のコメント :
コメントを投稿