No, the reduce() method of a ReduceFunction requires two elements.
The first received element is just put into state. Once the second element arrives, both are given to the ReduceFunction and the result is put into state and replaces the first element.
So, if my reduce function applies some transformation I must migrate that transformation to a map before the reduce to ensure it transforms, even if there is only one element?
I can chain them together and it will be "almost" as they were in the same function(Ensure same thread processing)?
You can use a MapFunction (however, it will touch each element and not only the first). An alternative could be the AggregateFunction if you are using ReduceFunction on a WindowedStream. The interface is a bit more complex though.
So, if my reduce function applies some transformation I must migrate that
transformation to a map before the reduce to ensure it transforms, even if
there is only one element?
I can chain them together and it will be "almost" as they were in the same
function(Ensure same thread processing)?
My goal is to touch each element before the aggregation but i could do it in the reduce function a not having to add another function, thus creating more overhead. The reduce method receives the reduced and a new element which i would change and apply my aggregation.
I'm doing keyby->reduce.
Using a map before all this is a solution.
I've never tried AggregateFunction, any examples?