With the current implementation of CombinerAggregatorCombineImpl, you
can modify and return the first value if you want to avoid the small
overhead of creating new instances (it adds up!)
It would be 100% safe if this behaviour was documented and contractual
for a CombinerAggregator. It's not, so the trade-off is (a)
creating/gc'ing fewer instances versus (b) potential future breakages if
the implementation changes.
see:
https://github.com/apache/storm/blob/b2a8a77c3b307137527c706d0cd7635a6afe25bf/storm-core/src/jvm/storm/trident/operation/impl/CombinerAggregatorCombineImpl.java
All my best, Ryan
On 23/10/2014 15:58, Delm Schmidt wrote:
Hi guys,
maybe someone can help me out.
I'm trying to write my own CombinerAggregator. Hence I'm extending the
CombinerAggregator<T> Interface but I do not know how to efficiently
implement the 'T combine(T val1, T val2)' method.
Is it allowed to modify the val1 attribute and then return it or
should I create a new object and combine the values inside the newly
created one?