T - the type of the elements of the input PCollectionpublic static class Count.Globally<T> extends PTransform<PCollection<T>,PCollection<Long>>
Count.Globally<T> takes a PCollection<T> and returns a
PCollection<Long> containing a single element that is the total
number of elements in the PCollection.
Example of use:
PCollection<String> words = ...;
PCollection<Long> wordCount =
words.apply(Count.<String>globally());
name| Constructor and Description |
|---|
Globally() |
| Modifier and Type | Method and Description |
|---|---|
PCollection<Long> |
apply(PCollection<T> input)
Applies this
PTransform on the given InputT, and returns its
Output. |
Count.Globally<T> |
withHotKeyFanout(int fanout)
Returns a
PTransform identical to Globally(), but that uses an intermedate combining
node to improve performance. |
Count.Globally<T> |
withoutDefaults()
Returns a
PTransform identical to Globally(), but that does not attempt to
provide a default value in the case of empty input. |
getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validatepublic Count.Globally<T> withoutDefaults()
PTransform identical to Globally(), but that does not attempt to
provide a default value in the case of empty input.public Count.Globally<T> withHotKeyFanout(int fanout)
PTransform identical to Globally(), but that uses an intermedate combining
node to improve performance. See Combine.Globally.withFanout(int).public PCollection<Long> apply(PCollection<T> 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).
The default implementation throws an exception. A derived class must
either implement apply, or else each runner must supply a custom
implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT).
apply in class PTransform<PCollection<T>,PCollection<Long>>