cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Li Tao <ahumbleco...@gmail.com>
Subject Re: Nested Collections in Cassandra
Date Sun, 06 Dec 2015 03:47:45 GMT
how about saving it as blob type?
On Nov 16, 2015 12:18 AM, "Neha Dave" <nehajtrivedi@gmail.com> wrote:

> Hi Jack,
> Thanks for the response.
>
> Do you think it's a good idea to have a separate table like :
>
> CREATE TYPE metadata (
>       key text,
>       value set<text>,
>       path_id uuid
>   );
>
> And then index it on Value so that the query like... :
> SELECT * from metadata where value CONTAINS {values: {'FOX'};
>
> 2. Can I use composite column? any idea?
>
> regards
> neha
>
>
>
>
> On Sat, Nov 14, 2015 at 9:21 PM, Jack Krupansky <jack.krupansky@gmail.com>
> wrote:
>
>> You can only nest frozen collections and even then you can only access
>> the full nested value, not individual entries within the nested map.
>>
>> So, in your example, you can only access mimetype and then must specify
>> the full mime type value, which doesn't satisfy your query requirement.
>>
>> You will need to flatten your nesting into distinct rows with clustering
>> keys. Then you can query a row with the mimetype in a clustering key. And
>> add a clustering key for the mime values name.
>>
>> -- Jack Krupansky
>>
>> On Sat, Nov 14, 2015 at 5:16 AM, Neha Dave <nehajtrivedi@gmail.com>
>> wrote:
>>
>>> Any Help?
>>>
>>> On Tue, Nov 10, 2015 at 7:44 PM, Neha Dave <nehajtrivedi@gmail.com>
>>> wrote:
>>>
>>>> How can we achieve Nested Collections in cassandra.
>>>>
>>>> My requirement :
>>>> metadata map<text,list<text>> ... Is it possible?
>>>>
>>>> Eg. 'mime-type' : 'MIME'
>>>>       'Security'  : {'SOX','FOX'}
>>>>
>>>> Query will be Give me all the ID's where 'Security'  : {'SOX'} OR
>>>> contains 'SOX'
>>>>
>>>> Is it Possible?
>>>> Can I use UDT to do it?
>>>>
>>>> Eg CQL :
>>>>
>>>> CREATE TYPE security (
>>>>       number text,
>>>>       tags set<text>
>>>>   );
>>>>
>>>>
>>>> CREATE TYPE listdata (
>>>>       values set<text>
>>>>   );
>>>>
>>>>   CREATE TABLE test_path (
>>>>       path_id text PRIMARY KEY,
>>>>       metadata map<text, frozen<listdata>>
>>>>   );
>>>>
>>>> INSERT INTO test_path (path_id, metadata ) VALUES ( '2', { 'mime-type':
>>>> {values : {'Mime'}}
>>>> {'applicable-security-policy' : {'SOX','FOX'}} });
>>>>
>>>>
>>>> Query (which does not work) can be :
>>>> SELECT * from test_path where metadata CONTAINS {values: {'FOX'},
>>>> 'SOX'}} ;
>>>> OR
>>>> SELECT * from test_path where metadata CONTAINS {values: {'FOX'};
>>>>
>>>>
>>>> Thanks
>>>> Regards
>>>> Neha
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Mime
View raw message