I think you are seeing the behavior described at in
http://issues.apache.org/jira/browse/THRIFT-455, where "In C++,
optional fields require applications to manually set __isset fields,
otherwise they are not serialized on writing."  Apparently this is
considered a "feature."

-Jonathan

On Thu, Dec 10, 2009 at 10:26 PM, Padraig O'Sullivan
<osullivan.padr...@gmail.com> wrote:
> Hi!
>
> I was curious if anyone has had success using the C++ interface to
> Cassandra? I've been having some difficulties and just wanted to check
> if I was doing something wrong before debugging further or if there
> was any known issues with C++ interface.
>
> I have a simple test program to demonstrate my issue (headers and
> using namespace declarations omitted for clarity):
>
> int main()
> {
>  shared_ptr<TTransport> socket(new TSocket(host, port));
>  shared_ptr<TTransport> transport(new TBufferedTransport(socket));
>  shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
>  CassandraClient client(protocol);
>  try
>  {
>    transport->open();
>    ColumnPath old_col;
>    old_col.column_family.assign("Data");
>    old_col.super_column.assign("");
>    old_col.column.assign("first");
>    ColumnOrSuperColumn ret_val;
>    client.get(ret_val,
>               "drizzle",
>               "padraig",
>               old_col,
>               ZERO);
>    transport->close();
>  }
>  catch (InvalidRequestException &re)
>  {
>    printf("ERROR: %s\n", re.why.c_str());
>  }
>  catch (TException &tx)
>  {
>    printf("ERROR: %s\n", tx.what());
>  }
> }
>
> Now, when I run this, I get the following (from the InvalidRequestException):
>
> $ ./simple_get
> ERROR: column parameter is not optional for standard CF Data
> $
>
> When I look at the relevant piece of code in the method
> validateColumnPath() in ThriftValidation.java, I see the following:
>
> if (column_path.column == null)
> {
>  throw new InvalidRequestException("column parameter is not optional
> for standard CF " + column_path.column_family);
> }
>
> and I can confirm that the super_column and column members of the
> ColumnPath object are appearing as null strings in this method but the
> column parameter is not being passed as a null parameter from my C++
> program.
>
> So basically, I'm just wondering if anyone has successfully used the
> C++ interface generated by thrift to Cassandra? Are there any issues
> with it that I am not aware of? Has anyone else encountered this
> problem?
>
> I should mention that I checked out the latest version of thrift from
> SVN and used that to generate the C++ files for interfacing with
> cassandra and I used git to clone the latest version of Cassandra (the
> output of show version from the CLI shows the Cassandra version as
> 0.5-beta1).
>
> Thanks,
> Padraig
>

Reply via email to