incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Manuel Garcia del Moral <j...@southcode.com.ar>
Subject Re: SuperColumns in C++ API
Date Mon, 15 Mar 2010 21:16:22 GMT
Ok, I'll check out libcassandra in a while.

I've been able to insert values with this:

    new_col.__isset.super_column = true;
    new_col.__isset.column     = true; /* this is required! */
    new_col.column_family.assign("Anonimos");
    new_col.super_column.assign("Tag");
    new_col.column.assign("300");

    client.insert("SocialAds",
                  "50",
                  new_col,
                  "5",
                  12345678,
                  ONE);

I thought I could GET it by doing:

    client.get(ret_val,
               "SocialAds",
               "50",
               new_col,
               ONE);

But I'm getting this error:
 Default TException.

Ah nothing on the server log

Thanks, and sorry for all these newbie questions


2010/3/15 Jonathan Ellis <jbellis@gmail.com>

> you're still not setting isset on column_family.
>
> you need both isset and assign on each value you're sending.
>
> maybe you should use http://github.com/posulliv/libcassandra ?
>
> On Mon, Mar 15, 2010 at 3:29 PM, Juan Manuel Garcia del Moral
> <juan@southcode.com.ar> wrote:
> > Ok,
> >
> > Now I've changed to:
> >
> >     ColumnPath new_col;
> >     new_col.__isset.super_column = true;
> >     new_col.__isset.column     = true; /* this is required! */
> >     new_col.column_family.assign("Anonimos");
> >     new_col.super_column.assign("Tag");
> >     new_col.column.assign("300");
> >
> >
> >     client.insert("SocialAds",
> >                   "1",
> >                   new_col,
> >                   "200",
> >                   12345678,
> >                   ONE);
> >
> > I'm not getting any error but no entry on the log either, and the value
> is
> > not being inserted...
> >
> >
> > Thanks
> >
> >
> > 2010/3/15 Jonathan Ellis <jbellis@gmail.com>
> >>
> >> Ah, thrift is letting you set something to be null, that shouldn't be
> >> legal.  This is fixed in 0.6 svn, btw.
> >>
> >> it looks like you are setting new_col.__isset.column to true, but not
> >> actually assigning it a value.
> >>
> >> On Mon, Mar 15, 2010 at 3:14 PM, Juan Manuel Garcia del Moral
> >> <juan@southcode.com.ar> wrote:
> >> > This is what the log says:
> >> >
> >> > ERROR [pool-1-thread-8] 2010-03-15 15:54:06,753 Cassandra.java (line
> >> > 1482)
> >> > Internal error processing insert
> >> > java.lang.AssertionError: QueryPath(columnFamilyName='Anonimos',
> >> > superColumnName='[B@d0357a', columnName='null')
> >> >         at
> >> > org.apache.cassandra.db.ColumnFamily.addColumn(ColumnFamily.java:165)
> >> >         at
> >> > org.apache.cassandra.db.ColumnFamily.addColumn(ColumnFamily.java:159)
> >> >         at
> org.apache.cassandra.db.RowMutation.add(RowMutation.java:159)
> >> >         at
> >> >
> >> >
> org.apache.cassandra.thrift.CassandraServer.insert(CassandraServer.java:351)
> >> >         at
> >> >
> >> >
> org.apache.cassandra.thrift.Cassandra$Processor$insert.process(Cassandra.java:1474)
> >> >         at
> >> >
> >> >
> org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:1115)
> >> >         at
> >> >
> >> >
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:253)
> >> >         at
> >> >
> >> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >> >         at
> >> >
> >> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >> >         at java.lang.Thread.run(Thread.java:619)
> >> >
> >> >
> >> > I need to do replicate this:
> >> > set SocialAds.Anonimos['122']['Tag']['150'] = '100';
> >> >
> >> > from my code...
> >> >
> >> > any ideas?
> >> >
> >> > thanks in advance
> >> >
> >> > Juan
> >> >
> >> >
> >> > 2010/3/15 Jonathan Ellis <jbellis@gmail.com>
> >> >>
> >> >> check the server log for exception.  and if you are not on 0.5.1 or
> >> >> 0.6 svn branch, upgrade.
> >> >>
> >> >> On Mon, Mar 15, 2010 at 12:47 PM, Juan Manuel Garcia del Moral
> >> >> <juan@southcode.com.ar> wrote:
> >> >> > Many thanks!
> >> >> >
> >> >> > That seems to be useful,
> >> >> >
> >> >> > But now I'm getting
> >> >> >  The error message: "Internal error processing insert"
> >> >> >
> >> >> > I'm not sure if I'm setting the timestamp properly
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2010/3/15 Padraig O'Sullivan <osullivan.padraig@gmail.com>
> >> >> >>
> >> >> >> You need to manually set the __isset fields when using the
thift
> API
> >> >> >> in C++. Since you are trying to insert a super column, you
need to
> >> >> >> set
> >> >> >> the super_column __isset field.
> >> >> >>
> >> >> >> So this:
> >> >> >>
> >> >> >> new_col.__isset.column = true;
> >> >> >>
> >> >> >> should become:
> >> >> >>
> >> >> >> new_col.__isset.super_column = true;
> >> >> >>
> >> >> >> -Padraig
> >> >> >>
> >> >> >> On Mon, Mar 15, 2010 at 12:36 PM, Juan Manuel Garcia del Moral
> >> >> >> <juan@southcode.com.ar> wrote:
> >> >> >> > Hello
> >> >> >> >
> >> >> >> > I'm trying to add values using supercolumns but I get
this error
> >> >> >> >
> >> >> >> > ERROR: supercolumn parameter is not optional for super
CF
> Anonimos
> >> >> >> >
> >> >> >> > This is my code
> >> >> >> >
> >> >> >> > // **********
> >> >> >> >  ColumnPath new_col;
> >> >> >> >     new_col.__isset.column     = true; /* this is required!
*/
> >> >> >> >     new_col.column_family.assign("Anonimos");
> >> >> >> >     new_col.super_column.assign("Tag");
> >> >> >> >
> >> >> >> >     client.insert("SocialAds",
> >> >> >> >                   "1",
> >> >> >> >                   new_col,
> >> >> >> >                   "200",
> >> >> >> >                   123456789,
> >> >> >> >                   ONE);
> >> >> >> >
> >> >> >> > // **********
> >> >> >> >
> >> >> >> > What I'm doing wrong?
> >> >> >> >
> >> >> >> > Thanks
> >> >> >> >
> >> >> >> > Juan
> >> >> >> >
> >> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> >
> >
> >
> >
> > --
> > Juan Manuel García del Moral
> > Southcode Global IT Resources
> > jm@southcode.com.ar
> > http://www.southcode.com.ar
> >
> >
>



-- 
Juan Manuel García del Moral
Southcode Global IT Resources
jm@southcode.com.ar
http://www.southcode.com.ar

Mime
View raw message