cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tuukka Mustonen <tuukka.musto...@gmail.com>
Subject Re: Storing values of mixed types in a list
Date Tue, 24 Jun 2014 18:21:24 GMT
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 define separate fields for
each value. Running queries would be cumbersome (something like WHERE items
CONTAINS {'text_value': 'foobar'} or WHERE items CONTAINS {'int_value': 3}.
Pavel, did you mean like this?

I'm running 2.1rc1 with python driver 2.0.2.

Tuukka


On Tue, Jun 24, 2014 at 4:39 PM, Pavel Kogan <pavel.kogan@cortica.com>
wrote:

> 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 <jeremy@barchart.com>
> wrote:
>
>> 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" <tuukka.mustonen@gmail.com>
>> 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 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 per type, using list of user types in Cassandra 2.1, etc.), but I get
>>> a bad feeling about each.
>>>
>>> Couldn't find an "exact" answer to this through searches...
>>> Regards,
>>> Tuukka
>>>
>>> P.S. I first asked this at SO before realizing the traffic there is very
>>> low:
>>> http://stackoverflow.com/questions/24380158/storing-a-list-of-mixed-types-in-cassandra
>>>
>>>
>

Mime
View raw message