1.异常情况
使用 SlidingEventTimeWindows 窗口,后面直接一个reduce算子,数据会出现倍增情况。
代码:
DataStreamSource<String> localhost = env.socketTextStream("localhost", 9991, "\n");
final SingleOutputStreamOperator<DataEntity> dataSteam = localhost
.flatMap(new FlatMapFunction<String, DataEntity>() {
@Override
public void flatMap(String value, Collector<DataEntity> out) throws Exception {
try {
DataEntity dataEntity = new DataEntity();
dataEntity.setCount(1);
dataEntity.setKey("121212");
dataEntity.setEventTime(System.currentTimeMillis());
out.collect(dataEntity);
} catch (Exception e) {
int p = 0;
}
}
});
dataSteam.print("source-");
SingleOutputStreamOperator<DataEntity> datawmStream = dataSteam
.assignTimestampsAndWatermarks(new BoundedOutOfOr

最低0.47元/天 解锁文章
985

被折叠的 条评论
为什么被折叠?



