incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Morton <aa...@thelastpickle.com>
Subject Re: Cannot restrict PRIMARY KEY part bucket_id by IN relation as a collection is selected by the query
Date Tue, 12 Nov 2013 03:49:08 GMT
The code just says we cannot support it yet, it may come in the future:

                    // We only support IN for the last name and for compact storage so far
                    // TODO: #3885 allows us to extend to non compact as well, but that remains
to be done

> Should this be modelled in a different way in Cassandra? Could you please advice?


Depends on what you are doing with the map column. 

This is roughly the same as using the map, but in a different table:

CREATE TABLE device_map (
  mdid text,
  bucket_id text,
  map_key	text, 
  map_value text,
  PRIMARY KEY(  (mdid, bucket_id), map_key)
)

Cheers

-----------------
Aaron Morton
New Zealand
@aaronmorton

Co-Founder & Principal Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com

On 8/11/2013, at 1:05 am, pavlikus@gmail.com wrote:

> Hey guys, just started to learn Cassandra recently, got a simple (hopefully) question
on querying.
> 
> There's a table with composite primary key - mdid and bucket_id. So I assume mdid is
going to be a partition key and bucket_id is a clustering key. There're also two more columns
to hold a text and a map. See http://pastie.org/private/fcygmm891hgg4ugyjhtjg for a full picture.
> 
> So, I am basically going to have a big row with may buckets. In my application I am going
to retrieve a subset of buckets, not all of them at once, so I do this:
> 
> select .... where mdid='1' and bucket_id in ('global_props', 'test_bucket')
> 
> But that gives the error in the subject.
> 
> There's pretty interesting thing is that if I query for text column then the query works,
while does not work for the map column. Check the two queries at the bottom http://pastie.org/private/fcygmm891hgg4ugyjhtjg
please.
> 
> Should this be modelled in a different way in Cassandra? Could you please advice?
> 
> Thanks, 
> Pavlo


Mime
View raw message