Skip to content

Commit

Permalink
Initialising ReducerAggregator if (when) state is null.
Browse files Browse the repository at this point in the history
This is an attempt at overcoming the problem outlined here:
https://groups.google.com/d/topic/storm-user/3kQU_8FO1xg/discussion
  • Loading branch information
lorcan committed Feb 12, 2013
1 parent f94a7bf commit c843ec2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jvm/storm/trident/state/ReducerValueUpdater.java
Expand Up @@ -15,10 +15,10 @@ public ReducerValueUpdater(ReducerAggregator agg, List<TridentTuple> tuples) {


@Override @Override
public Object update(Object stored) { public Object update(Object stored) {
Object ret = stored; Object ret = (stored == null) ? this.agg.init() : stored;
for(TridentTuple t: tuples) { for(TridentTuple t: tuples) {
ret = this.agg.reduce(ret, t); ret = this.agg.reduce(ret, t);
} }
return ret; return ret;
} }
} }

0 comments on commit c843ec2

Please sign in to comment.