how to output the last 5 max values in Esper?

312 views Asked by At

i have a question regarding Esper in java. Imagine that i have events with two elements for each event : money, name.

What I want to do is to output 3 different names that have the most money. Is there any way of doing this ?

example of events:

100,adrien-10,john-15,sam-20,sosa-36,nicolas

---> i would like to output: adrien,nicolas and sosa in this case. I'm able to output only the one with the max(amount), but not a certain number of names (in my case 3).

Thanks for your help

1

There are 1 answers

0
user3613754 On

Esper is a streaming engine so when does output occur, i.e. are you going to send a triggering event that indicates that all events have been sent? Or does output occur after 1 minute or what causes output? Is this totaling up or just a rank? If its a rank by name use the ranked data window and "output snapshot". Or if your question is not a streaming analysis then you could simply insert rows into a named window and perform a fire and forget query.