replacement for KeyedStream.fold(..) ?

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

replacement for KeyedStream.fold(..) ?

Peter Ertl
Hi folks,

since KeyedStream.fold(..) is marked as @deprecated what is the proper replacement for that kind of functionality?

Is mapWithState() and flatMapWithState() a *full* replacement?

Cheers
Peter
Reply | Threaded
Open this post in threaded view
|

Re: replacement for KeyedStream.fold(..) ?

Nico Kruber
Hi Peter,
although unfortunately not documented yet in [1] (rumor has it that that is
going to change soon) and without a proper replacement note in the deprecation
javadoc, two things come to mind for replacing fold():

* AggregateFunction and
[All]WindowedStream#aggregate(AggregateFunction<T,ACC,R>) to create aggregates
of all events in a window
* a stateful [flat]map (as you mentioned)

These two should cover all cases.
Or did you have any use case in mind that doesn't fit in there?


Nico

[1] https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/windows.html

On Wednesday, 2 August 2017 23:56:16 CEST Peter Ertl wrote:
> Hi folks,
>
> since KeyedStream.fold(..) is marked as @deprecated what is the proper
> replacement for that kind of functionality?
>
> Is mapWithState() and flatMapWithState() a *full* replacement?
>
> Cheers
> Peter


signature.asc (201 bytes) Download Attachment