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.
question from:
https://stackoverflow.com/questions/65848095/implications-of-merge-method-in-aggregatefunction 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…