I am trying to understand the AggregateFunction in Flink which is described here. Totally it has four methods namely,
- createAccumulator
- add
- getResult
- merge
From my understanding,
createAccumulator method is invoked when the first element enters into a new window and newly created instance will be used further
add method is invoked to reduce the result based on definition and this uses the instance which is created in createAccumulator method
getResult method is invoked when a window is closed and returns the available result
Whether my understanding about the above methods are correct or not? Finally, what is the use-case of merge method and when it is used/invoked? The definition available here is not clear for me.