getCurrentWatermark

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getCurrentWatermark

梦怀
@Override
public final Watermark getCurrentWatermark() {
   // this guarantees that the watermark never goes backwards.
   long potentialWM = currentMaxTimestamp - maxOutOfOrderness;
   if (potentialWM >= lastEmittedWatermark) {                                  //currentMaxTimestamp 这个已经是最大的了,单调递增,为什么这个还需判断
      lastEmittedWatermark = potentialWM;
   }
   return new Watermark(lastEmittedWatermark);
}

@Override
public final long extractTimestamp(T element, long previousElementTimestamp) {
   long timestamp = extractTimestamp(element);
   if (timestamp > currentMaxTimestamp) {
      currentMaxTimestamp = timestamp;
   }
   return timestamp;
}
Reply | Threaded
Open this post in threaded view
|

Re: getCurrentWatermark

HunterXHunter
currentMaxTimestamp 只是当前数据流里面最大,但不一定是全部的最大。
当数据出现延迟,或者多流的情况下,lastEmittedWatermark 不一定会比 currentMaxTimestamp 小



--
Sent from: http://apache-flink.147419.n8.nabble.com/