public class CombineFns
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | CombineFns.CoCombineResultA tuple of outputs produced by a composed combine functions. | 
| static class  | CombineFns.ComposeCombineFnBuilderA builder class to construct a composed  CombineFnBase.GlobalCombineFn. | 
| static class  | CombineFns.ComposedCombineFn<DataT>A composed  Combine.CombineFnthat applies multipleCombineFns. | 
| static class  | CombineFns.ComposedCombineFnWithContext<DataT>A composed  CombineWithContext.CombineFnWithContextthat applies multipleCombineFnWithContexts. | 
| Constructor and Description | 
|---|
| CombineFns() | 
| Modifier and Type | Method and Description | 
|---|---|
| static CombineFns.ComposeCombineFnBuilder | compose()Returns a  CombineFns.ComposeCombineFnBuilderto construct a composedCombineFnBase.GlobalCombineFn. | 
public static CombineFns.ComposeCombineFnBuilder compose()
CombineFns.ComposeCombineFnBuilder to construct a composed CombineFnBase.GlobalCombineFn.
 The same TupleTag cannot be used in a composition multiple times.
 
Example:
 PCollection<Integer> globalLatencies = ...;
 TupleTag<Integer> maxLatencyTag = new TupleTag<Integer>();
 TupleTag<Double> meanLatencyTag = new TupleTag<Double>();
 SimpleFunction<Integer, Integer> identityFn =
     new SimpleFunction<Integer, Integer>() {
       {@literal @}Override
       public Integer apply(Integer input) {
           return input;
       }};
 PCollection<CoCombineResult> maxAndMean = globalLatencies.apply(
     Combine.globally(
         CombineFns.compose()
            .with(identityFn, new MaxIntegerFn(), maxLatencyTag)
            .with(identityFn, new MeanFn<Integer>(), meanLatencyTag)));
 PCollection<T> finalResultCollection = maxAndMean
     .apply(ParDo.of(
         new DoFn<CoCombineResult, T>() {
          {@literal @}ProcessElement
           public void processElement(
            {@literal @}Element CoCombineResult e, OutputReceiver<T> r) throws Exception {
             Integer maxLatency = e.get(maxLatencyTag);
             Double meanLatency = e.get(meanLatencyTag);
             .... Do Something ....
             r.output(...some T...);
           }
         }));