@Internal public class PunctuatedWatermarkAssignerWrapper extends Object implements AssignerWithPunctuatedWatermarks<RowData>
PunctuatedWatermarkAssigner
.NO_TIMESTAMP
Constructor and Description |
---|
PunctuatedWatermarkAssignerWrapper(PunctuatedWatermarkAssigner assigner,
int timeFieldIdx,
DataType sourceType) |
Modifier and Type | Method and Description |
---|---|
Watermark |
checkAndGetNextWatermark(RowData row,
long extractedTimestamp)
Asks this implementation if it wants to emit a watermark.
|
long |
extractTimestamp(RowData element,
long recordTimestamp)
Assigns a timestamp to an element, in milliseconds since the Epoch.
|
public PunctuatedWatermarkAssignerWrapper(PunctuatedWatermarkAssigner assigner, int timeFieldIdx, DataType sourceType)
timeFieldIdx
- the index of the rowtime attribute.assigner
- the watermark assigner.sourceType
- the type of source@Nullable public Watermark checkAndGetNextWatermark(RowData row, long extractedTimestamp)
AssignerWithPunctuatedWatermarks
TimestampAssigner.extractTimestamp(Object, long)
method.
The returned watermark will be emitted only if it is non-null and its timestamp is larger than that of the previously emitted watermark (to preserve the contract of ascending watermarks). If a null value is returned, or the timestamp of the returned watermark is smaller than that of the last emitted one, then no new watermark will be generated.
For an example how to use this method, see the documentation of this class
.
checkAndGetNextWatermark
in interface AssignerWithPunctuatedWatermarks<RowData>
Null
, if no watermark should be emitted, or the next watermark to emit.public long extractTimestamp(RowData element, long recordTimestamp)
TimestampAssigner
The method is passed the previously assigned timestamp of the element. That previous
timestamp may have been assigned from a previous assigner, by ingestion time. If the element
did not carry a timestamp before, this value is Long.MIN_VALUE
.
extractTimestamp
in interface TimestampAssigner<RowData>
element
- The element that the timestamp will be assigned to.recordTimestamp
- The previous internal timestamp of the element, or a negative value,
if no timestamp has been assigned yet.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.