Class Watermark

  • All Implemented Interfaces:
    Serializable

    @Public
    public final class Watermark
    extends Object
    implements Serializable
    Watermarks are the progress indicators in the data streams. A watermark signifies that no events with a timestamp smaller or equal to the watermark's time will occur after the water. A watermark with timestamp T indicates that the stream's event time has progressed to time T.

    Watermarks are created at the sources and propagate through the streams and operators.

    In some cases a watermark is only a heuristic, meaning some events with a lower timestamp may still follow. In that case, it is up to the logic of the operators to decide what to do with the "late events". Operators can for example ignore these late events, route them to a different stream, or send update to their previously emitted results.

    When a source reaches the end of the input, it emits a final watermark with timestamp Long.MAX_VALUE, indicating the "end of time".

    Note: A stream's time starts with a watermark of Long.MIN_VALUE. That means that all records in the stream with a timestamp of Long.MIN_VALUE are immediately late.

    See Also:
    Serialized Form
    • Field Detail

      • MAX_WATERMARK

        public static final Watermark MAX_WATERMARK
        The watermark that signifies end-of-event-time.
    • Constructor Detail

      • Watermark

        public Watermark​(long timestamp)
        Creates a new watermark with the given timestamp in milliseconds.
    • Method Detail

      • getTimestamp

        public long getTimestamp()
        Returns the timestamp associated with this Watermark.
      • getFormattedTimestamp

        public String getFormattedTimestamp()
        Formats the timestamp of this watermark, assuming it is a millisecond timestamp. The returned format is "yyyy-MM-dd HH:mm:ss.SSS".
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object