Questions about FoldFunction and WindowFunction

Posted by Yassine MARZOUGUI on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Questions-about-FoldFunction-and-WindowFunction-tp9824.html

Hi all,

I have a couple questions about FoldFunction and WindowFunction:

1. When using a RichFoldFunction after a window as in keyedStream.window().fold(new RichFoldFunction()), is the close() method called after each window or after all the windows for that key are fired?

2. When applying a FoldFunction to a window followed by a WindowFunction via apply(R initialValue, FoldFunction<T,R> foldFunction, WindowFunction<R,R,K,W> function), why should the output of the WindowFunction be of the same type as the input? It would be practical to have a different output type sometimes, for example one would fold tuples in the FoldFunction and then process the (only) aggregated tuple in the Window function and emit an Integer.

Best,
Yassine