You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Peter Ertl <pe...@gmx.net> on 2017/08/02 21:56:16 UTC

replacement for KeyedStream.fold(..) ?

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

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

Posted by Nico Kruber <ni...@data-artisans.com>.
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