public class Count extends Object
PTransorms to count the elements in a PCollection.
perElement() can be used to count the number of occurrences of each
distinct element in the PCollection. globally() can
be used to count the total number of elements in a PCollection.
| Modifier and Type | Class and Description |
|---|---|
static class |
Count.PerElement<T>
Count.PerElement<T> takes a PCollection<T> and returns a
PCollection<KV<T, Long>> representing a map from each distinct element of the input
PCollection to the number of times that element occurs in the input. |
| Constructor and Description |
|---|
Count() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Combine.Globally<T,Long> |
globally()
|
static <T> Count.PerElement<T> |
perElement()
Returns a
Count.PerElement PTransform that counts the number of
occurrences of each element in its input PCollection. |
static <K,V> Combine.PerKey<K,V,Long> |
perKey()
Returns a
Combine.PerKey PTransform that counts the number of elements
associated with each key of its input PCollection. |
public static <T> Combine.Globally<T,Long> globally()
public static <K,V> Combine.PerKey<K,V,Long> perKey()
Combine.PerKey PTransform that counts the number of elements
associated with each key of its input PCollection.public static <T> Count.PerElement<T> perElement()
Count.PerElement PTransform that counts the number of
occurrences of each element in its input PCollection.
See Count.PerElement for more details.