T
- The type of the elements to which this assigner assigns timestamps.public interface AssignerWithPeriodicWatermarks<T> extends TimestampAssigner<T>
AssignerWithPeriodicWatermarks
assigns event time timestamps to elements,
and generates low watermarks that signal event time progress within the stream.
These timestamps and watermarks are used by functions and operators that operate
on event time, for example event time windows.
This class is used to generate watermarks in a periodical interval.
At most every i
milliseconds (configured via
ExecutionConfig.getAutoWatermarkInterval()
, the system will call the
getCurrentWatermark()
method to probe for the next watermark value.
The system will generate a new watermark, if the probed value is larger than
zero and larger than the previous watermark.
The system may call the getCurrentWatermark()
method less often than every
i
milliseconds, of no new elements arrived since the last call to the
method.
Timestamps and watermarks are defined as longs
that represent the
milliseconds since the Epoch (midnight, January 1, 1970 UTC).
A watermark with a certain value t
indicates that no elements with event
timestamps x
, where x
is lower or equal to t
, will occur any more.
Watermark
Modifier and Type | Method and Description |
---|---|
Watermark |
getCurrentWatermark()
Returns the current watermark.
|
extractTimestamp
Watermark getCurrentWatermark()
The returned watermark will be emitted only if it is non-null and larger than the previously emitted watermark. If the current watermark is still identical to the previous one, no progress in event time has happened since the previous call to this method.
If this method returns a value that is smaller than the previously returned watermark, then the implementation does not properly handle the event stream timestamps. In that case, the returned watermark will not be emitted (to preserve the contract of ascending watermarks), and the violation will be logged and registered in the metrics.
The interval in which this method is called and Watermarks are generated
depends on ExecutionConfig.getAutoWatermarkInterval()
.
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.