Class Watermark
- java.lang.Object
-
- org.apache.flink.api.common.eventtime.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 ofLong.MIN_VALUE
are immediately late.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Watermark
MAX_WATERMARK
The watermark that signifies end-of-event-time.
-
Constructor Summary
Constructors Constructor Description Watermark(long timestamp)
Creates a new watermark with the given timestamp in milliseconds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getFormattedTimestamp()
Formats the timestamp of this watermark, assuming it is a millisecond timestamp.long
getTimestamp()
Returns the timestamp associated with this Watermark.int
hashCode()
String
toString()
-
-
-
Field Detail
-
MAX_WATERMARK
public static final Watermark MAX_WATERMARK
The watermark that signifies end-of-event-time.
-
-
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".
-
-