Latest
Pydoc |
Gets the element with the latest timestamp.
Examples
In the following examples, we create a pipeline with a PCollection
of produce with a timestamp for their harvest date.
We use Latest
to get the element with the latest timestamp from the PCollection
.
Example 1: Latest element globally
We use Latest.Globally()
to get the element with the latest timestamp in the entire PCollection
.
Example 2: Latest elements for each key
We use Latest.PerKey()
to get the elements with the latest timestamp for each key in a PCollection
of key-values.
Related transforms
- Sample randomly takes some number of elements in a collection.
Pydoc |
Last updated on 2024/12/05
Have you found everything you were looking for?
Was it all useful and clear? Is there anything that you would like to change? Let us know!