Thanks Aljosha for the reply. So what can I do in my reduce function that contains transient variables (i.e. not serializable)?
On Mon, Jul 20, 2020 at 4:38 PM Aljoscha Krettek <aljos...@apache.org> wrote: > Hi Flavio, > > the reason is that under the covers the ReduceFunction will be used as > the ReduceFunction of a ReducingState. And those cannot be rich > functions because we cannot provide all the required context "inside" > the state backend. > > You can see how the ReduceFunction is used to create a > ReducingStateDescriptor here: > > https://github.com/apache/flink/blob/0c43649882c831c1ec88f4e33d8a59b1cbf5f2fe/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L300 > > Best, > Aljoscha > > On 16.07.20 16:28, Flavio Pompermaier wrote: > > Hi to all, > > I'm trying to apply a rich reduce function after a countWindowAll but > Flink > > says > > "ReduceFunction of reduce can not be a RichFunction. Please use > > reduce(ReduceFunction, WindowFunction) instead." > > > > Is there any good reason for this? Or am I doing something wrong? > > > > Best, > > Flavio > > >