Permalink
Browse files

Initialising ReducerAggregator if (when) state is null.

This is an attempt at overcoming the problem outlined here:
https://groups.google.com/d/topic/storm-user/3kQU_8FO1xg/discussion
  • Loading branch information...
1 parent f94a7bf commit c843ec23d86d6360c018a478723bdee16f9dc427 @lorcan lorcan committed Feb 12, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jvm/storm/trident/state/ReducerValueUpdater.java
@@ -15,10 +15,10 @@ public ReducerValueUpdater(ReducerAggregator agg, List<TridentTuple> tuples) {
@Override
public Object update(Object stored) {
- Object ret = stored;
+ Object ret = (stored == null) ? this.agg.init() : stored;
for(TridentTuple t: tuples) {
ret = this.agg.reduce(ret, t);
}
return ret;
}
-}
+}

0 comments on commit c843ec2

Please sign in to comment.