Hi Daniel, This does not quite work since newValuesStream only emits the values that are updated, not everything. So it would result in the updated values being counted twice in the total count
On Tue, Jun 24, 2014 at 8:19 PM, Danijel Schiavuzzi <[email protected]> wrote: > Can, > > Take a look at the newValuesStream, maybe you can chain another aggregator > on top of your first persistentAggregate this way. > > > On Tuesday, June 24, 2014, Can Gencer <[email protected]> wrote: > >> This would probably work, however it wouldn't be reusing the calculations >> already done after the group by, which was my main intention. >> >> >> On Tue, Jun 24, 2014 at 6:15 PM, Adam Lewis <[email protected]> wrote: >> >>> It sounds like you want a persistentAggregate to occur before the stream >>> grouping by word, would this work? >>> in pseudo trident DSL: >>> >>> Stream words = ...; >>> words.groupBy(word).persistentAggregate(...); >>> words.persistentAggregate(...); >>> >>> >>> On Tue, Jun 24, 2014 at 12:45 PM, Can Gencer <[email protected]> wrote: >>> >>>> Hi all, >>>> >>>> I'm wondering what is the best way to "chain" persistent aggregations >>>> in Trident. >>>> >>>> Let's say I have a running count of words and I also want to do another >>>> aggregation to calculate the total count of all words using the results of >>>> the previous aggregation. >>>> >>>> I can use a persistentAggregate to calculate the running total for each >>>> word. However I can't use another persistentAggregate directly chained to >>>> that as that would only add the new value instead of decrementing the old >>>> value for the group first. >>>> >>>> What is the best solution to this scenario? Does storm have a way to >>>> handle this out of the box? >>>> >>>> Regards, >>>> Can >>>> >>> >>> >> > > -- > Danijel Schiavuzzi > > E: [email protected] > W: www.schiavuzzi.com > T: +385989035562 > Skype: danijels7 >
