When using a BoundedOutOfOrdernessTimestampExtractor, the trigger is not firing. However, the trigger fires when using custom timestamp extractor with similar watermark.
Sample code below: 1.Assigner as anonymous class which works fine
AssignerWithPeriodicWatermarks<Tuple2<Rule, T>> assigner = new AssignerWithPeriodicWatermarks<Tuple2<Rule, T>>() {
@Override
public long extractTimestamp(Tuple2<Rule, T> element, long previousElementTimestamp) {
return System.currentTimeMillis();
}
@Override
public final Watermark getCurrentWatermark() {
return new Watermark(System.currentTimeMillis()-100);
}
};
2.BoundedOutOfOrdernessTimestampExtractor assigner which doesn't work
AssignerWithPeriodicWatermarks<Tuple2<Rule, T>> assigner = new BoundedOutOfOrdernessTimestampExtractor<Tuple2<Rule, T>>(Time.milliseconds(100)) {
@Override
public long extractTimestamp(Tuple2<Rule, T> element) {
return System.currentTimeMillis();
}
};
Do you see any difference in the approaches?
Answer copied from flink mailing list :
The difference is that the Watermarks from BoundedOutOfOrdernessTimestampExtractor are based on the greatest timestamp of all previous events. That is, if you do not receive new events, the Watermark will not advance. In contrast, your custom implementation of AssignerWithPeriodicWatermarks always advances the Watermark based on the wall clock.
Since I was using a small static set of events, the watermark was not advancing when using BOOTE.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.