Class Watermark
- java.lang.Object
-
- org.apache.flink.streaming.runtime.streamrecord.StreamElement
-
- org.apache.flink.streaming.api.watermark.Watermark
-
- Direct Known Subclasses:
InternalWatermark
@PublicEvolving public class Watermark extends StreamElement
A Watermark tells operators that no elements with a timestamp older or equal to the watermark timestamp should arrive at the operator. Watermarks are emitted at the sources and propagate through the operators of the topology. Operators must themselves emit watermarks to downstream operators usingOutput.emitWatermark(Watermark)
. Operators that do not internally buffer elements can always forward the watermark that they receive. Operators that buffer elements, such as window operators, must forward a watermark after emission of elements that is triggered by the arriving watermark.In some cases a watermark is only a heuristic and operators should be able to deal with late elements. They can either discard those or update the result and emit updates/retractions to downstream operations.
When a source closes it will emit a final watermark with timestamp
Long.MAX_VALUE
. When an operator receives this it will know that no more input will be arriving in the future.
-
-
Field Summary
Fields Modifier and Type Field Description static Watermark
MAX_WATERMARK
The watermark that signifies end-of-event-time.protected long
timestamp
The timestamp of the watermark in milliseconds.static Watermark
UNINITIALIZED
The watermark that signifies is used before any actual watermark has been generated.
-
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)
long
getTimestamp()
Returns the timestamp associated with thisWatermark
in milliseconds.int
hashCode()
String
toString()
-
Methods inherited from class org.apache.flink.streaming.runtime.streamrecord.StreamElement
asLatencyMarker, asRecord, asRecordAttributes, asWatermark, asWatermarkStatus, isLatencyMarker, isRecord, isRecordAttributes, isWatermark, isWatermarkStatus
-
-
-
-
Field Detail
-
MAX_WATERMARK
public static final Watermark MAX_WATERMARK
The watermark that signifies end-of-event-time.
-
UNINITIALIZED
public static final Watermark UNINITIALIZED
The watermark that signifies is used before any actual watermark has been generated.
-
timestamp
protected final long timestamp
The timestamp of the watermark in milliseconds.
-
-
Method Detail
-
getTimestamp
public long getTimestamp()
Returns the timestamp associated with thisWatermark
in milliseconds.
-
-