apache_beam.transforms.combiners module¶
A library of basic combiner PTransform subclasses.
-
class
apache_beam.transforms.combiners.
Mean
[source]¶ Bases:
object
Combiners for computing arithmetic means of elements.
-
class
Globally
(has_defaults=True)[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
combiners.Mean.Globally computes the arithmetic mean of the elements.
-
class
PerKey
(label=None)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
combiners.Mean.PerKey finds the means of the values for each key.
-
class
-
class
apache_beam.transforms.combiners.
Count
[source]¶ Bases:
object
Combiners for counting elements.
-
class
Globally
(has_defaults=True)[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
combiners.Count.Globally counts the total number of elements.
-
class
PerKey
(label=None)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
combiners.Count.PerKey counts how many elements each unique key has.
-
class
PerElement
(label=None)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
combiners.Count.PerElement counts how many times each element occurs.
-
class
-
class
apache_beam.transforms.combiners.
Top
[source]¶ Bases:
object
Combiners for obtaining extremal elements.
-
class
Of
(n, **kwargs)[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
Obtain a list of the compare-most N elements in a PCollection.
This transform will retrieve the n greatest elements in the PCollection to which it is applied, where “greatest” is determined by the comparator function supplied as the compare argument.
Creates a global Top operation.
The arguments ‘key’ and ‘reverse’ may be passed as keyword arguments, and have the same meaning as for Python’s sort functions.
Parameters: - pcoll – PCollection to process.
- n – number of elements to extract from pcoll.
- **kwargs – may contain ‘key’ and/or ‘reverse’
-
class
PerKey
(n, **kwargs)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
Identifies the compare-most N elements associated with each key.
This transform will produce a PCollection mapping unique keys in the input PCollection to the n greatest elements with which they are associated, where “greatest” is determined by the comparator function supplied as the compare argument in the initializer.
Creates a per-key Top operation.
The arguments ‘key’ and ‘reverse’ may be passed as keyword arguments, and have the same meaning as for Python’s sort functions.
Parameters: - pcoll – PCollection to process.
- n – number of elements to extract from pcoll.
- **kwargs – may contain ‘key’ and/or ‘reverse’
-
static
Largest
(pcoll, n, has_defaults=True)[source]¶ Obtain a list of the greatest N elements in a PCollection.
-
static
Smallest
(pcoll, n, has_defaults=True)[source]¶ Obtain a list of the least N elements in a PCollection.
-
class
-
class
apache_beam.transforms.combiners.
Sample
[source]¶ Bases:
object
Combiners for sampling n elements without replacement.
-
class
apache_beam.transforms.combiners.
ToList
(label='ToList')[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
A global CombineFn that condenses a PCollection into a single list.
-
class
apache_beam.transforms.combiners.
ToDict
(label='ToDict')[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
A global CombineFn that condenses a PCollection into a single dict.
PCollections should consist of 2-tuples, notionally (key, value) pairs. If multiple values are associated with the same key, only one of the values will be present in the resulting dict.
-
class
apache_beam.transforms.combiners.
ToSet
(label='ToSet')[source]¶ Bases:
apache_beam.transforms.combiners.CombinerWithoutDefaults
A global CombineFn that condenses a PCollection into a set.