Latest

Pydoc 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.

Pydoc Pydoc