Adding Timestamp - ParDo

Bounded sources (such as a file from TextIO) do not provide timestamps for elements. If you need timestamps, you must add them to your PCollection’s elements.

You can assign new timestamps to the elements of a PCollection by applying a ParDo transform that outputs new elements with timestamps that you set.

Kata: Please assign each element a timestamp based on the the Event.getDate().


Use ParDo with DoFn.
Use OutputReceiver.outputWithTimestamp method to assign timestamp to the element.
Refer to the Beam Programming Guide "Adding timestamps to a PCollection’s elements" section for more information.