You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Colin Vipurs <zo...@gmail.com> on 2010/03/24 10:57:46 UTC

Slice Query

Hi all,

I've just started playing with Cassandra and investigating if it's
useful for us, so please be gentle when I ask silly questions :).

When user super columns is it possible to perform a slice operation to
pull out all SC's/Keys that match a specific/range of column names?
Putting it more concretely, if I had:

ColumnFamily {
   'key1' {
      'SuperColumn1' {
         'Column1' : <somevalue>
         'Column2' : <somevalue>
      }
      'SuperColumn2' {
         'Column3' : <somevalue>
      }
   }
   'key2' {
      'SuperColumn1' {
         'Column1' : <somevalue>
      }
    }
}

Could I get all keys/supercolumns where 'Column1' exists? fyi I'm
using the Hector Java client for my work.

Thanks



-- 
Maybe she awoke to see the roommate's boyfriend swinging from the
chandelier wearing a boar's head.

Something which you, I, and everyone else would call "Tuesday", of course.

Re: Slice Query

Posted by Jonathan Ellis <jb...@gmail.com>.
On Wed, Mar 24, 2010 at 4:57 AM, Colin Vipurs <zo...@gmail.com> wrote:
> Could I get all keys/supercolumns where 'Column1' exists? fyi I'm
> using the Hector Java client for my work.

Not servir-side, no.

-Jonathan

Re: Slice Query

Posted by Colin Vipurs <zo...@gmail.com>.
I'm not doing schema migration, but I suspect my lack of experience
and understanding of column-based data is clouding the issue.  What I
have is 2 pieces of information, let's call them LH and RH and a
single long value representing the link between them, S.  The data
needs to be ordered by S, so the data I have in mind looks like this:

CF {
   LH1 {
      S1 {
         RH1
         RH2
         RH3
      }
      S2 {
         RH2
         RH3
      }
   }
   LH2 {
      S1 {
         RH1
         RH2
      }
      S2 {
         RH3
         RH4
      }
   }
}

At some point in the application lifecycle an event is received to
indicate the S value needs updating for the LH,RH pair.  Initially I
was thinking of using a second column family as an index, and would
look like:

LH1 {
   RH1 : S1
   RH2 : S1
   .....
}

And using that to key into the structure above, but then was trying to
figure out if I could bypass the second index completely.

For other operations I need to extract the Top X entries for each row
key (LH)- does this sound sane or am I still stuck in RDBMS land?


On Wed, Mar 24, 2010 at 12:56 PM, Jeremy Dunck <jd...@gmail.com> wrote:
> On Wed, Mar 24, 2010 at 4:57 AM, Colin Vipurs <zo...@gmail.com> wrote:
> ...
>> ColumnFamily {
>>   'key1' {
>>      'SuperColumn1' {
>>         'Column1' : <somevalue>
>>         'Column2' : <somevalue>
>>      }
>>      'SuperColumn2' {
>>         'Column3' : <somevalue>
>>      }
>>   }
>>   'key2' {
>>      'SuperColumn1' {
>>         'Column1' : <somevalue>
>>      }
>>    }
>> }
>>
>> Could I get all keys/supercolumns where 'Column1' exists? fyi I'm
>> using the Hector Java client for my work.
>
> I think maybe you're asking because you want to perform schema migration.
>
> If so, one option is to have client-side code that mutates to the
> later schema upon encountering the old schema.
> Another option is to have a schema-versioning column, and have a job
> that fetches and mutates records w/ the old schema.
>
> If there are other ways of handling schema migration, I'm curious?
>



-- 
Maybe she awoke to see the roommate's boyfriend swinging from the
chandelier wearing a boar's head.

Something which you, I, and everyone else would call "Tuesday", of course.

Re: Slice Query

Posted by Jeremy Dunck <jd...@gmail.com>.
On Wed, Mar 24, 2010 at 4:57 AM, Colin Vipurs <zo...@gmail.com> wrote:
...
> ColumnFamily {
>   'key1' {
>      'SuperColumn1' {
>         'Column1' : <somevalue>
>         'Column2' : <somevalue>
>      }
>      'SuperColumn2' {
>         'Column3' : <somevalue>
>      }
>   }
>   'key2' {
>      'SuperColumn1' {
>         'Column1' : <somevalue>
>      }
>    }
> }
>
> Could I get all keys/supercolumns where 'Column1' exists? fyi I'm
> using the Hector Java client for my work.

I think maybe you're asking because you want to perform schema migration.

If so, one option is to have client-side code that mutates to the
later schema upon encountering the old schema.
Another option is to have a schema-versioning column, and have a job
that fetches and mutates records w/ the old schema.

If there are other ways of handling schema migration, I'm curious?