public class Combine
extends java.lang.Object
PTransforms for combining PCollection elements globally and per-key.
 See the documentation for how to use the operations in this class.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | Combine.AccumulatingCombineFn<InputT,AccumT extends Combine.AccumulatingCombineFn.Accumulator<InputT,AccumT,OutputT>,OutputT>A  CombineFnthat uses a subclass ofCombine.AccumulatingCombineFn.Accumulatoras its
 accumulator type. | 
| static class  | Combine.BinaryCombineDoubleFnAn abstract subclass of  Combine.CombineFnfor implementing combiners that are more easily and
 efficiently expressed as binary operations ondoubles. | 
| static class  | Combine.BinaryCombineFn<V>An abstract subclass of  Combine.CombineFnfor implementing combiners that are more easily
 expressed as binary operations. | 
| static class  | Combine.BinaryCombineIntegerFnAn abstract subclass of  Combine.CombineFnfor implementing combiners that are more easily and
 efficiently expressed as binary operations onints | 
| static class  | Combine.BinaryCombineLongFnAn abstract subclass of  Combine.CombineFnfor implementing combiners that are more easily and
 efficiently expressed as binary operations onlongs. | 
| static class  | Combine.CombineFn<InputT,AccumT,OutputT>A  CombineFn<InputT, AccumT, OutputT>specifies how to combine a collection of input
 values of typeInputTinto a single output value of typeOutputT. | 
| static class  | Combine.Globally<InputT,OutputT>Combine.Globally<InputT, OutputT>takes aPCollection<InputT>and returns aPCollection<OutputT>whose elements are the result of combining all the elements in
 each window of the inputPCollection, using a specifiedCombineFn<InputT, AccumT, OutputT>. | 
| static class  | Combine.GloballyAsSingletonView<InputT,OutputT>Combine.GloballyAsSingletonView<InputT, OutputT>takes aPCollection<InputT>and returns aPCollectionView<OutputT>whose elements are the result of combining all
 the elements in each window of the inputPCollection, using a specifiedCombineFn<InputT, AccumT, OutputT>. | 
| static class  | Combine.GroupedValues<K,InputT,OutputT>GroupedValues<K, InputT, OutputT>takes aPCollection<KV<K, Iterable<InputT>>>,
 such as the result ofGroupByKey, applies a specifiedCombineFn<InputT, AccumT, OutputT>to each of the inputKV<K, Iterable<InputT>>elements to produce a combined outputKV<K, OutputT>element, and returns aPCollection<KV<K, OutputT>>containing all the combined output elements. | 
| static class  | Combine.Holder<V>Holds a single value value of type  Vwhich may or may not be present. | 
| static class  | Combine.IterableCombineFn<V> | 
| static class  | Combine.PerKey<K,InputT,OutputT>PerKey<K, InputT, OutputT>takes aPCollection<KV<K, InputT>>, groups it by
 key, applies a combining function to theInputTvalues associated with each key to
 produce a combinedOutputTvalue, and returns aPCollection<KV<K, OutputT>>representing a map from each distinct key of the inputPCollectionto the corresponding
 combined value. | 
| static class  | Combine.PerKeyWithHotKeyFanout<K,InputT,OutputT>Like  Combine.PerKey, but sharding the combining of hot keys. | 
| static class  | Combine.SimpleCombineFn<V>Deprecated.  | 
| Modifier and Type | Method and Description | 
|---|---|
| static <InputT,OutputT> | globally(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)Returns a  Combine.GloballyPTransformthat uses the givenGloballyCombineFnto combine all the elements in each window of the inputPCollectioninto a single value in the outputPCollection. | 
| static <V> Combine.Globally<V,V> | globally(SerializableBiFunction<V,V,V> combiner)Returns a  Combine.GloballyPTransformthat uses the givenSerializableBiFunctionto combine all the elements in each window of the inputPCollectioninto a single value in the outputPCollection. | 
| static <V> Combine.Globally<V,V> | globally(SerializableFunction<java.lang.Iterable<V>,V> combiner)Returns a  Combine.GloballyPTransformthat uses the givenSerializableFunctionto combine all the elements in each window of the inputPCollectioninto a single value in the outputPCollection. | 
| static <K,InputT,OutputT> | groupedValues(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)Returns a  Combine.GroupedValuesPTransformthat takes aPCollectionofKVs where a key maps to anIterableof values, e.g., the result
 of aGroupByKey, then uses the givenCombineFnto combine all the values
 associated with a key, ignoring the key. | 
| static <K,V> Combine.GroupedValues<K,V,V> | groupedValues(SerializableBiFunction<V,V,V> fn)Returns a  Combine.GroupedValuesPTransformthat takes aPCollectionofKVs where a key maps to anIterableof values, e.g., the result
 of aGroupByKey, then uses the givenSerializableFunctionto combine all the
 values associated with a key, ignoring the key. | 
| static <K,V> Combine.GroupedValues<K,V,V> | groupedValues(SerializableFunction<java.lang.Iterable<V>,V> fn)Returns a  Combine.GroupedValuesPTransformthat takes aPCollectionofKVs where a key maps to anIterableof values, e.g., the result
 of aGroupByKey, then uses the givenSerializableFunctionto combine all the
 values associated with a key, ignoring the key. | 
| static <K,InputT,OutputT> | perKey(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)Returns a  Combine.PerKeyPTransformthat first groups its inputPCollectionofKVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns aPCollectionofKVs
 mapping each distinct key to its combined value for each window. | 
| static <K,V> Combine.PerKey<K,V,V> | perKey(SerializableBiFunction<V,V,V> fn)Returns a  Combine.PerKeyPTransformthat first groups its inputPCollectionofKVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns aPCollectionofKVs
 mapping each distinct key to its combined value for each window. | 
| static <K,V> Combine.PerKey<K,V,V> | perKey(SerializableFunction<java.lang.Iterable<V>,V> fn)Returns a  Combine.PerKeyPTransformthat first groups its inputPCollectionofKVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns aPCollectionofKVs
 mapping each distinct key to its combined value for each window. | 
public static <V> Combine.Globally<V,V> globally(SerializableFunction<java.lang.Iterable<V>,V> combiner)
Combine.Globally PTransform that uses the given SerializableFunction to combine all the elements in each window of the input PCollection into a single value in the output PCollection. The types of the input
 elements and the output elements must be the same.
 If the input PCollection is windowed into GlobalWindows, a default value in
 the GlobalWindow will be output if the input PCollection is empty. To use this
 with inputs with other windowing, either Combine.Globally.withoutDefaults() or Combine.Globally.asSingletonView() must be called.
 
See Combine.Globally for more information.
public static <V> Combine.Globally<V,V> globally(SerializableBiFunction<V,V,V> combiner)
Combine.Globally PTransform that uses the given SerializableBiFunction to combine all the elements in each window of the input PCollection into a single value in the output PCollection. The types of the input
 elements and the output elements must be the same.
 If the input PCollection is windowed into GlobalWindows, a default value in
 the GlobalWindow will be output if the input PCollection is empty. To use this
 with inputs with other windowing, either Combine.Globally.withoutDefaults() or Combine.Globally.asSingletonView() must be called.
 
See Combine.Globally for more information.
public static <InputT,OutputT> Combine.Globally<InputT,OutputT> globally(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)
Combine.Globally PTransform that uses the given GloballyCombineFn to combine all the elements in each window of the input PCollection
 into a single value in the output PCollection. The types of the input elements and the
 output elements can differ.
 If the input PCollection is windowed into GlobalWindows, a default value in
 the GlobalWindow will be output if the input PCollection is empty. To use this
 with inputs with other windowing, either Combine.Globally.withoutDefaults() or Combine.Globally.asSingletonView() must be called.
 
See Combine.Globally for more information.
public static <K,V> Combine.PerKey<K,V,V> perKey(SerializableFunction<java.lang.Iterable<V>,V> fn)
Combine.PerKey PTransform that first groups its input PCollection of KVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns a PCollection of KVs
 mapping each distinct key to its combined value for each window.
 Each output element is in the window by which its corresponding input was grouped, and has
 the timestamp of the end of that window. The output PCollection has the same WindowFn as the input.
 
See Combine.PerKey for more information.
public static <K,V> Combine.PerKey<K,V,V> perKey(SerializableBiFunction<V,V,V> fn)
Combine.PerKey PTransform that first groups its input PCollection of KVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns a PCollection of KVs
 mapping each distinct key to its combined value for each window.
 Each output element is in the window by which its corresponding input was grouped, and has
 the timestamp of the end of that window. The output PCollection has the same WindowFn as the input.
 
See Combine.PerKey for more information.
public static <K,InputT,OutputT> Combine.PerKey<K,InputT,OutputT> perKey(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)
Combine.PerKey PTransform that first groups its input PCollection of KVs by keys and windows, then invokes the given function on each of the
 values lists to produce a combined value, and then returns a PCollection of KVs
 mapping each distinct key to its combined value for each window.
 Each output element is in the window by which its corresponding input was grouped, and has
 the timestamp of the end of that window. The output PCollection has the same WindowFn as the input.
 
See Combine.PerKey for more information.
public static <K,V> Combine.GroupedValues<K,V,V> groupedValues(SerializableFunction<java.lang.Iterable<V>,V> fn)
Combine.GroupedValues PTransform that takes a PCollection of KVs where a key maps to an Iterable of values, e.g., the result
 of a GroupByKey, then uses the given SerializableFunction to combine all the
 values associated with a key, ignoring the key. The type of the input and output values must be
 the same.
 Each output element has the same timestamp and is in the same window as its corresponding
 input element, and the output PCollection has the same WindowFn associated with it as the input.
 
See Combine.GroupedValues for more information.
 
Note that perKey(SerializableFunction) is typically more convenient to use than
 GroupByKey followed by groupedValues(...).
public static <K,V> Combine.GroupedValues<K,V,V> groupedValues(SerializableBiFunction<V,V,V> fn)
Combine.GroupedValues PTransform that takes a PCollection of KVs where a key maps to an Iterable of values, e.g., the result
 of a GroupByKey, then uses the given SerializableFunction to combine all the
 values associated with a key, ignoring the key. The type of the input and output values must be
 the same.
 Each output element has the same timestamp and is in the same window as its corresponding
 input element, and the output PCollection has the same WindowFn associated with it as the input.
 
See Combine.GroupedValues for more information.
 
Note that perKey(SerializableBiFunction) is typically more convenient to use than
 GroupByKey followed by groupedValues(...).
public static <K,InputT,OutputT> Combine.GroupedValues<K,InputT,OutputT> groupedValues(CombineFnBase.GlobalCombineFn<? super InputT,?,OutputT> fn)
Combine.GroupedValues PTransform that takes a PCollection of KVs where a key maps to an Iterable of values, e.g., the result
 of a GroupByKey, then uses the given CombineFn to combine all the values
 associated with a key, ignoring the key. The types of the input and output values can differ.
 Each output element has the same timestamp and is in the same window as its corresponding
 input element, and the output PCollection has the same WindowFn associated with it as the input.
 
See Combine.GroupedValues for more information.
 
Note that perKey(CombineFnBase.GlobalCombineFn) is typically more convenient to use
 than GroupByKey followed by groupedValues(...).