you can see Storm's builtin operation Count: 

https://github.com/apache/storm/blob/b2a8a77c3b307137527c706d0cd7635a6afe25bf/storm-core/src/jvm/storm/trident/operation/builtin/Count.java

it return the new object:

@Override
public Long combine(Long val1, Long val2) {
return val1 + val2;
}




2014-10-24



shengyi.pan



发件人:"Delm Schmidt" <d...@gmx.net>
发送时间:2014-10-23 21:58
主题:Implement the CombinerAggregator
收件人:"user"<user@storm.apache.org>
抄送:

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?

Reply via email to