Gets the element with the latest timestamp.
In the following examples, we create a pipeline with a
PCollection of produce with a timestamp for their harvest date.
Latest to get the element with the latest timestamp from the
Example 1: Latest element globally
Latest.Globally() to get the element with the latest timestamp in the entire
Example 2: Latest elements for each key
Latest.PerKey() to get the elements with the latest timestamp for each key in a
PCollection of key-values.
- Sample randomly takes some number of elements in a collection.
Last updated on 2024/03/04
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!