Storing values of mixed types in a list

2014-06-24 Thread Tuukka Mustonen
Hello, I need to store a list of mixed types in Cassandra. The list may contain numbers, strings and booleans. So I would need something like list. Is this possible in Cassandra and if not, what workaround would you suggest for storing a list of mixed type items? I sketched a few (using a list pe

Re: Storing values of mixed types in a list

2014-06-24 Thread Jeremy Jongsma
Use a ByteBuffer value type with your own serialization (we use protobuf for complex value structures) On Jun 24, 2014 5:30 AM, "Tuukka Mustonen" wrote: > Hello, > > I need to store a list of mixed types in Cassandra. The list may contain > numbers, strings and booleans. So I would need something

Re: Storing values of mixed types in a list

2014-06-24 Thread Pavel Kogan
1) You can use list of strings which are serialized JSONs, or use ByteBuffer with your own serialization as Jeremy suggested. 2) Use Cassandra 2.1 (not officially released yet) were there is new feature of user defined types. Pavel On Tue, Jun 24, 2014 at 9:18 AM, Jeremy Jongsma wrote: > Use

Re: Storing values of mixed types in a list

2014-06-24 Thread Tuukka Mustonen
What if I need to query by list items? 1. Jeremy, with blob field (ByteBuffer), I can query exact matches (just encode the value in query), but greater/less than queries would not work. Any sort of serialization kills "native" ways to query data 2. Even with user defined types, I would need to def

Re: Storing values of mixed types in a list

2014-06-24 Thread DuyHai Doan
"Jeremy, with blob field (ByteBuffer), I can query exact matches (just encode the value in query), but greater/less than queries would not work. Any sort of serialization kills "native" ways to query data" --> Not necessarily. You still use "normal" types (uuid, string, timestamp,...) for clusterin

Re: Storing values of mixed types in a list

2014-06-24 Thread Tuukka Mustonen
Unfortunately, I need to query per list items. That's why I'm running Cassandra 2.1rc1 (offers secondary indexes for collections). I'm also studying Dynamo, it seems to be somewhat more dynamic by nature and allows mixed type lists. As I understood it, also Cassandra supports dynamic schemas, but

Re: Storing values of mixed types in a list

2014-06-25 Thread Sylvain Lebresne
On Wed, Jun 25, 2014 at 8:49 AM, Tuukka Mustonen wrote: > Unfortunately, I need to query per list items. That's why I'm running > Cassandra 2.1rc1 (offers secondary indexes for collections). > Using a list of blobs does not in any way prevent you from doing that. Types are constraints on what va

Re: Storing values of mixed types in a list

2014-06-25 Thread Tuukka Mustonen
Sorry for confusion, I should have lined my requirements better in the first place. Let me try to summarize: - I can use list and query against it using secondary indexes and by encoding my data on the client side. However, *this only allows exact matches, not greater/lesser than *for numbers at l

Re: Storing values of mixed types in a list

2014-06-25 Thread Tuukka Mustonen
Actually, come to think of it, of course I cannot run greater/less than queries on list items anyway (would be something like "WHERE items CONTAINS > 4"), so binary encoding should be fine. Thanks for everybody's input! Tuukka On Wed, Jun 25, 2014 at 1:49 PM, Tuukka Mustonen wrote: > Sorry for

Re: Storing values of mixed types in a list

2014-06-25 Thread Robert Coli
On Tue, Jun 24, 2014 at 11:49 PM, Tuukka Mustonen wrote: > Unfortunately, I need to query per list items. That's why I'm running > Cassandra 2.1rc1 (offers secondary indexes for collections). > As a general statement, if you have to use a just added feature in a pre-release version of the Datast