You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Rafael Ribeiro <ra...@gmail.com> on 2010/04/26 00:04:04 UTC

range get over subcolumns on supercolumn family

Hi all!

 I am trying to do a paginated query on the subcolumns of a superfamily
column but sincerely I am a little bit confused.
 I have already been able to do a range query but only over the keys of a
regular column family.
 For the keys case I've been able to do so using the code below:

            KeyRange keyRange = new KeyRange(count);
            keyRange.setStart_key(startKey);
            keyRange.setEnd_key("");

            SliceRange range = new SliceRange();
            range.setStart(new byte[] {});
            range.setFinish(new byte[] {});

            SlicePredicate predicate = new SlicePredicate();
            predicate.setSlice_range(range);

            ColumnParent cp = new ColumnParent("ColumnFamily");

            List<KeySlice> keySlices = client.get_range_slices("Keyspace",
cp, predicate, keyRange, ConsistencyLevel.ALL);

 Is there any way I can do a similar approach to do the range query on the
subcolumns? Would I need to do some trick over ColumnParent? I tried setting
the supercolumn attribute but with no success (sincerely I knew it wont work
but it was worth trying). Only to clarify a little bit... I am still
exercising what is possible to do with Cassandra and I was willing to store
a key over a supercolumnfamily with uuid keys under it so I could scan it
using an ordering scheme but without loading the whole data under the top
level key.

best regards,
Rafael Ribeiro

Re: range get over subcolumns on supercolumn family

Posted by Rafael Ribeiro <ra...@gmail.com>.
Just found the way...
keyRange start and end key will be the same and instead of specifying the
count and start on KeyRange it has to be specified on SliceRange and then
keySlices will come with a single key and a list of columns...



2010/4/25 Rafael Ribeiro <ra...@gmail.com>

> Hi all!
>
>  I am trying to do a paginated query on the subcolumns of a superfamily
> column but sincerely I am a little bit confused.
>  I have already been able to do a range query but only over the keys of a
> regular column family.
>  For the keys case I've been able to do so using the code below:
>
>             KeyRange keyRange = new KeyRange(count);
>             keyRange.setStart_key(startKey);
>             keyRange.setEnd_key("");
>
>             SliceRange range = new SliceRange();
>             range.setStart(new byte[] {});
>             range.setFinish(new byte[] {});
>
>             SlicePredicate predicate = new SlicePredicate();
>             predicate.setSlice_range(range);
>
>             ColumnParent cp = new ColumnParent("ColumnFamily");
>
>             List<KeySlice> keySlices = client.get_range_slices("Keyspace",
> cp, predicate, keyRange, ConsistencyLevel.ALL);
>
>  Is there any way I can do a similar approach to do the range query on the
> subcolumns? Would I need to do some trick over ColumnParent? I tried setting
> the supercolumn attribute but with no success (sincerely I knew it wont work
> but it was worth trying). Only to clarify a little bit... I am still
> exercising what is possible to do with Cassandra and I was willing to store
> a key over a supercolumnfamily with uuid keys under it so I could scan it
> using an ordering scheme but without loading the whole data under the top
> level key.
>
> best regards,
> Rafael Ribeiro
>
>