Latest

Javadoc Javadoc


A transform and Combine.CombineFn for computing the latest element in a collection.

For elements with the same timestamp, the output element is arbitrarily selected.

Examples

Example 1: Compute the latest value for each session

 PCollection input = ...;
 PCollection sessioned = input
    .apply(Window.into(Sessions.withGapDuration(Duration.standardMinutes(5)));
 PCollection latestValues = sessioned.apply(Latest.globally());

Example 2: