K - the type of the keys in the input and output
PCollectionspublic class CoGroupByKey<K> extends PTransform<KeyedPCollectionTuple<K>,PCollection<KV<K,CoGbkResult>>>
PTransform that performs a CoGroupByKey on a tuple
of tables. A CoGroupByKey groups results from all
tables by like keys into CoGbkResults,
from which the results for any specific table can be accessed by the
TupleTag
supplied with the initial table.
Example of performing a CoGroupByKey followed by a
ParDo that consumes
the results:
{@code
PCollection> pt1 = ...;
PCollection> pt2 = ...;
final TupleTag t1 = new TupleTag<>();
final TupleTag t2 = new TupleTag<>();
PCollection> coGbkResultCollection =
KeyedPCollectionTuple.of(t1, pt1)
.and(t2, pt2)
.apply(CoGroupByKey.create());
PCollection finalResultCollection =
coGbkResultCollection.apply(ParDo.of(
new DoFn, T>() { name| Modifier and Type | Method and Description |
|---|---|
PCollection<KV<K,CoGbkResult>> |
apply(KeyedPCollectionTuple<K> input)
Applies this
PTransform on the given InputT, and returns its
Output. |
static <K> CoGroupByKey<K> |
create()
Returns a
CoGroupByKey<K> PTransform. |
getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validatepublic static <K> CoGroupByKey<K> create()
CoGroupByKey<K> PTransform.K - the type of the keys in the input and output
PCollectionspublic PCollection<KV<K,CoGbkResult>> apply(KeyedPCollectionTuple<K> input)
PTransformPTransform on the given InputT, and returns its
Output.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
apply in class PTransform<KeyedPCollectionTuple<K>,PCollection<KV<K,CoGbkResult>>>