You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Amit Handa <am...@gmail.com> on 2012/08/24 13:33:59 UTC

help required to resolve super column family problems

hi,
kindly help in resolving the following problem with respect to super column
family.
i am using cassandra version 1.1.3
i created two super families namely "UserMovies" and "movieSimilarity" in
cassandra using cassandra-cli:
*create column family movieSimilarity with column_type = 'Super'
and key_validation_class = UTF8Type
and subcomparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata = [{
    column_name: Movie, validation_class: UTF8Type},
    {column_name: peermovie, validation_class:UTF8Type},
    {column_name: similarity, validation_class: UTF8Type}];*

*create column family UserMovies with column_type = 'Super'
and key_validation_class = UTF8Type
and subcomparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata = [{
    column_name: userid, validation_class: UTF8Type},
    {column_name: movie, validation_class:UTF8Type},
    {column_name: rating, validation_class: UTF8Type}];*

I am facing two problems with it:

1) how to manually add data into it using cassandra-cli. i tried this type,
but got the error:
         set UserMovies['user1']['userid'] = 'USER-1';
but got error message: *Column family movieconsumed may only contain
SuperColumns*
(i want to add following data in cf: *UserMovies*
USER-1(userid) -- MOVIEABCD (movie) -- 9 (rating)
and following data in cf: *movieSimilarity*

MOVIEABCD(movie) --- MOVIEEFGH(peermovie) --- 0.88 (similarity)


2) as i want to make query to fetch peer movies name for particular
UserMovie(column name movie) for user(userid: user-1).
How i can perform this query using Hector api (from two super column
families UserMovies and movieSimilarity).

With Regards,
Amit

Re: help required to resolve super column family problems

Posted by Guillermo Winkler <gw...@inconcertcc.com>.
Hi Amit,


> 1) how to manually add data into it using cassandra-cli. i tried this
> type, but got the error:
>          set UserMovies['user1']['userid'] = 'USER-1';
> but got error message: *Column family movieconsumed may only contain
> SuperColumns*
>

I can't really see why you need a SC here since your example is not
representative, it would be better if you exemplify with accurate or
meaningful data.

In this case the error is because you have one element missing in the
column path, you are doing this:

UserMovies : {
   user1 : {
      userid:USER-1
   }
}

That is:
- Column family = UserMovies
- Row Key = user1
- Column name = userid
- Column value = USER-1

As you see you have the super column missing in your update sentence.

Given this example


> USER-1(userid) -- MOVIEABCD (movie) -- 9 (rating)
>

I think you don't need a SC, make the user the row key, movie the column
name and rating the column value.


>
> 2) as i want to make query to fetch peer movies name for particular
> UserMovie(column name movie) for user(userid: user-1).
> How i can perform this query using Hector api (from two super column
> families UserMovies and movieSimilarity).
>
>
Didn't understand your query.


Best,
Guille

Re: help required to resolve super column family problems

Posted by Aaron Turner <sy...@gmail.com>.
On Sun, Aug 26, 2012 at 9:28 PM, Amit Handa <am...@gmail.com> wrote:
> Hi,
>
> i basically want to do hands-on on Super Column family concept, making some
> examples using hector api, and manually adding the data.
> I explored hector-example project, but only got very starting level of super
> column family example.
> i am in search of more super column family examples using hector api. can i
> get some link and references related to it?

Is there a specific reason you want to use SuperColumns?  Basically,
it's a "feature" that the developers say you shouldn't use.  Most
people don't use them because of the rather poor performance
characteristics SC's have.

-- 
Aaron Turner
http://synfin.net/         Twitter: @synfinatic
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin
"carpe diem quam minimum credula postero"

Re: help required to resolve super column family problems

Posted by Amit Handa <am...@gmail.com>.
Hi,

i basically want to do hands-on on Super Column family concept, making some
examples using hector api, and manually adding the data.
I explored hector-example project, but only got very starting level of
super column family example.
i am in search of more super column family examples using hector api. can i
get some link and references related to it?


Regards,
Amit


On Sat, Aug 25, 2012 at 3:20 AM, Mohit Anchlia <mo...@gmail.com>wrote:

> If you are starting out new use composite column names/values or you could
> also use JSON style doc as a column value.
>
>
> On Fri, Aug 24, 2012 at 2:31 PM, Rob Coli <rc...@palominodb.com> wrote:
>
>> On Fri, Aug 24, 2012 at 4:33 AM, Amit Handa <am...@gmail.com>
>> wrote:
>> > kindly help in resolving the following problem with respect to super
>> column
>> > family.
>> > i am using cassandra version 1.1.3
>>
>> Well, THERE's your problem... ;D
>>
>> But seriously.. as I understand project intent, super columns will
>> ultimately be a weird API wrapper around composite keys. Also,  super
>> column families have not been well supported for years. You probably
>> just want to use composite keys if you are just starting out in 1.1.x.
>>
>> https://issues.apache.org/jira/browse/CASSANDRA-3237
>>
>> =Rob
>>
>> --
>> =Robert Coli
>> AIM&GTALK - rcoli@palominodb.com
>> YAHOO - rcoli.palominob
>> SKYPE - rcoli_palominodb
>>
>
>

Re: help required to resolve super column family problems

Posted by Mohit Anchlia <mo...@gmail.com>.
If you are starting out new use composite column names/values or you could
also use JSON style doc as a column value.

On Fri, Aug 24, 2012 at 2:31 PM, Rob Coli <rc...@palominodb.com> wrote:

> On Fri, Aug 24, 2012 at 4:33 AM, Amit Handa <am...@gmail.com> wrote:
> > kindly help in resolving the following problem with respect to super
> column
> > family.
> > i am using cassandra version 1.1.3
>
> Well, THERE's your problem... ;D
>
> But seriously.. as I understand project intent, super columns will
> ultimately be a weird API wrapper around composite keys. Also,  super
> column families have not been well supported for years. You probably
> just want to use composite keys if you are just starting out in 1.1.x.
>
> https://issues.apache.org/jira/browse/CASSANDRA-3237
>
> =Rob
>
> --
> =Robert Coli
> AIM&GTALK - rcoli@palominodb.com
> YAHOO - rcoli.palominob
> SKYPE - rcoli_palominodb
>

Re: help required to resolve super column family problems

Posted by Rob Coli <rc...@palominodb.com>.
On Fri, Aug 24, 2012 at 4:33 AM, Amit Handa <am...@gmail.com> wrote:
> kindly help in resolving the following problem with respect to super column
> family.
> i am using cassandra version 1.1.3

Well, THERE's your problem... ;D

But seriously.. as I understand project intent, super columns will
ultimately be a weird API wrapper around composite keys. Also,  super
column families have not been well supported for years. You probably
just want to use composite keys if you are just starting out in 1.1.x.

https://issues.apache.org/jira/browse/CASSANDRA-3237

=Rob

-- 
=Robert Coli
AIM&GTALK - rcoli@palominodb.com
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb