0

Is it possible to create a table with a primary key and a Set as a secondary column that would be like a list in a value of a hashtable?

something like this:

create table T (id int primary key, list HashSet )

where the list would hold all properties related to the primary key that happened over a window size.

EDIT:

This is the output I get. What I want is to keep count of unique Occurences arriving at id 1,2 and 3. If Occurence 2 arrived 3 times at ID 1 I still only want 1 as unique, not 3

{unique=3, id=1}
{unique=3, id=2}
{unique=4, id=3}
****************

In java it is no problem, but I dont understand how to implement this in Esper. Im not even sure if using tables is the correct approach.

wandapong
  • 59
  • 5

1 Answers1

1

Tables can have aggregation-state-type columns. So the "window" aggregation is available. For example like this:

create table MyTable (id int primary key, theWindow window(*) @type(MyEvent))

into table MyTable select window(*) as theWindow from MyEvent group by id

Or the table could declare a list-type column "create table MyTable (id int primary key, somelist java.util.List)" and it is up to you to maintain the list via function calls in EPL.

user3613754
  • 816
  • 1
  • 5
  • 5
  • Thanks, but how do I maintain the list? Where do I declare what type it should hold etc? in the create table statement or in the into statement? What I want is to keep track of unique Ids and count only unique Occurences to that id, like a count, but after i have the id i.e ID=1 UniqueOccurences = 3, but each occurnce has multiple tuples waiting. Just like a unique object holding multiple values – wandapong Jan 27 '17 at 21:36
  • I updated the OP with an example of the desired result I want – wandapong Jan 28 '17 at 01:20
  • "count of unique Occurences arriving at id 1,2 and 3." so that would be counting with the key being the id? But that count would result in a map of id to count value --- what does that have to do with a list? Your requirements are unclear and by throwing some half-baked design in there it gets impossible to understand. Suggest to be very clear with requirements. – user3613754 Jan 29 '17 at 13:19
  • Found out, using distinct count in the crate table statement – wandapong Jan 31 '17 at 08:11