Max
Provides a variety of different transforms for computing the maximum values in a collection, either globally or for each key.
Examples
Example 1: get the maximum of a PCollection
of Doubles
.
PCollection<Double> input = ...;
PCollection<Double> max = input.apply(Max.doublesGlobally());
Example 2: calculate the maximum of the Integers
associated
with each unique key (which is of type String
).
PCollection<KV<String, Integer>> input = ...;
PCollection<KV<String, Integer>> maxPerKey = input
.apply(Max.integersPerKey());