K - the type of the keys in the input PCollection, and the type of the elements in
the output PCollectionpublic class Keys<K> extends PTransform<PCollection<? extends KV<K,?>>,PCollection<K>>
Keys<K> takes a PCollection of KV<K, V>s and returns a PCollection<K> of the keys.
Example of use:
PCollection<KV<String, Long>> wordCounts = ...;
PCollection<String> words = wordCounts.apply(Keys.<String>create());
Each output element has the same timestamp and is in the same windows as its corresponding
input element, and the output PCollection has the same WindowFn associated with it as the input.
See also Values.
name| Modifier and Type | Method and Description |
|---|---|
static <K> Keys<K> |
create()
Returns a
Keys<K> PTransform. |
PCollection<K> |
expand(PCollection<? extends KV<K,?>> in)
Override this method to specify how this
PTransform should be expanded on the given
InputT. |
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validatepublic static <K> Keys<K> create()
Keys<K> PTransform.K - the type of the keys in the input PCollection, and the type of the elements
in the output PCollectionpublic PCollection<K> expand(PCollection<? extends KV<K,?>> in)
PTransformPTransform should be expanded on the given
InputT.
NOTE: This method should not be called directly. Instead apply the PTransform should
be applied to the InputT using the apply method.
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).
expand in class PTransform<PCollection<? extends KV<K,?>>,PCollection<K>>