Flink window evictor(TimeEvictor.of(Time.seconds(0))) 会出现 NullPoint问题

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

Flink window evictor(TimeEvictor.of(Time.seconds(0))) 会出现 NullPoint问题

HunterXHunter
当程序使用
evictor(TimeEvictor.of(Time.seconds(0)))
来清除 窗口触发前数据时,当数据全部被清除了,在print时会报Null point

Caused by: java.lang.NullPointerException
        at
org.apache.flink.api.common.functions.util.PrintSinkOutputWriter.write(PrintSinkOutputWriter.java:73)
        at
org.apache.flink.streaming.api.functions.sink.PrintSinkFunction.invoke(PrintSinkFunction.java:81)


为什么没数据也会传一个 null 到 Sink?



--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flink window evictor(TimeEvictor.of(Time.seconds(0))) 会出现 NullPoint问题

HunterXHunter
代码如下:
stream
.keyBy((KeySelector<Tuple2&lt;String, Long>, String>) o -> o.f0)
.window(TumblingEventTimeWindows.of(Time.seconds(100)))
.trigger(ContinuousProcessingTimeTrigger.of(Time.seconds(2)))
.evictor(TimeEvictor.of(Time.seconds(0)))
.sum(1)
.print();

当 数据在窗口计算前被全部清除时,sum结果会是一个null,会传入print,导致 nullpoint



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