Time 数据流-过去日期的时间窗口
我有过去事件时间的数据集Time 数据流-过去日期的时间窗口,time,stream,apache-flink,data-processing,Time,Stream,Apache Flink,Data Processing,我有过去事件时间的数据集 01-12-2015 01:10:10 01-12-2015 01:10:20 01-12-2015 01:10:30 01-12-2015 01:10:40 .... (millions of records) 我想为这个timeWindow(Time.seconds(30))应用timeWindow 我可以使用TimeExtractor类来获取数据中的EventTime。但是如何实现getCurrentWatermark方法呢。它应该获得过去的日期和时间在您的情况
01-12-2015 01:10:10
01-12-2015 01:10:20
01-12-2015 01:10:30
01-12-2015 01:10:40
.... (millions of records)
我想为这个timeWindow(Time.seconds(30))应用timeWindow
我可以使用TimeExtractor类来获取数据中的
EventTime
。但是如何实现getCurrentWatermark
方法呢。它应该获得过去的日期和时间在您的情况下,最好使用提供的时间赋值器之一
请参阅
因此,我建议如下:
DataStream<MyEvent> stream = ...
DataStream<MyEvent> withTimestampsAndWatermarks =
stream.assignTimestampsAndWatermarks(new AscendingTimestampExtractor<MyEvent>() {
@Override
public long extractAscendingTimestamp(MyEvent element) {
return element.getCreationTime();
}
});
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);