在应用keyBy,窗口和窗口应用后,无结果链接

问题描述 投票:0回答:1
我尝试对数据流进行一些Flink操作。但是我没有任何结果。有谁知道为什么不这样做。感谢您的帮助。

KeyedStream<Tuple2<String, Long>, Tuple> stream1 = stream.keyBy(0); stream1.print(); //Here I have results DataStream<Tuple3<Integer, String, Date>> stream2 = stream1.window(TumblingEventTimeWindows.of(Time.seconds(15))).apply(new WindowFunction<Tuple2<String, Long>, Tuple3<Integer, String, Date>, Tuple, TimeWindow>() { @Override public void apply(Tuple tuple, TimeWindow window, Iterable<Tuple2<String, Long>> input, Collector<Tuple3<Integer, String, Date>> out) { int counter = 0; for (Tuple2<String, Long> ignored : input) { counter++; } out.collect(new Tuple3<>( counter, tuple.get(0), //I also manually extracted the key from the Tuple, but that did also not work new Date(window.getEnd()))); } }); stream2.print(); //here I do not have any resulat

Flink版本:1.10没有错误
apache-flink flink-streaming
1个回答
0
投票
感谢DominikWosiński我找到了解决方案。

我提取了时间戳,但是忘记设置TimeCharacteristic。我忘记了以下行:

env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);

© www.soinside.com 2019 - 2024. All rights reserved.