Assuming there is a finite DataStream (from a database source, for example) with events
a1, a2, ..., an
.
How to append one more event b
to this stream to get
a1, a2, ..., an, b
(i.e. output the added event after all original events, preserving the original ordering)?
I know that all finite streams emit the MAX_WATERMARK
after all events. So, is there a way to "catch" this watermark and output the additional event after it?
(Unfortunately, .union()
ing the original DataStream with another DataStream consisting of a single event (with timestamp set to Long.MaxValue
) and then sorting the united stream using this answer did not work.)