views:

345

answers:

3

When using the Perl module Net::Cassandra::Easy to interface with Cassandra I use the following code to read colums col[123] from rows row[123] in the column-family Standard1:

my $cassandra = Net::Cassandra::Easy->new(keyspace => 'Keyspace1', server => 'localhost');
$cassandra->connect();
my $result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byname => ['col1', 'col2', 'col3']);

This works as expected.

However, when trying to insert row row1 with ..

$result = $cassandra->mutate(['row1'], family => 'Standard1', insertions => { "col1" => "Value to set." });

.. I get the error message Can't use string ("0") as a SCALAR ref while "strict refs" in use at .../Net/GenThrift/Thrift/BinaryProtocol.pm line 376.

What am I doing wrong?

+2  A: 
amphetamachine
Hi! Thanks for your answer. The binary protocol appears to have changed between 0.5 and 0.6, where Net::Cassandra::Easy seems to be targeting 0.6 only.
knorv
+2  A: 

The code works as expected under Cassandra 0.6.x, but fails under Cassandra 0.5.x.

It appears as if Net::Cassandra::Easy is targeting Cassandra 0.6.x only.

Upgrading to Cassandra 0.6.x solves the problem.

knorv
+1  A: 

hmm, it looks more like a Perl binding bug when handling exception to me.

I believe that 0.6 fixes it for you because the interface has indeed changed, so 0.6 is not raising a thrift exception anymore, but the bug in thrift remains. I've opened a JIRA case, we'll see that thrift team says about it:

https://issues.apache.org/jira/browse/THRIFT-758

Yann