views:

294

answers:

1

When using Perl's Net::Cassandra::Easy the following code will retrieve columns col[1-3] from rows row[1-3]:

$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byname => ['col1', 'col2', 'col3');

The corresponding SQL would be:

SELECT col1, col2, col3 FROM rows WHERE id IN ('row1', 'row2', 'row3');

Suppose instead that I want to retrieve all columns. In SQL terms that would be:

SELECT * FROM rows WHERE id IN ('row1', 'row2', 'row3');

To get all columns I am currently using:

$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byoffset => { "count" => 1_000_000 });

This works as long as the number of columns does not exceed one million. While this works I'd assume that there is a cleaner way to do it. Is there any cleaner way to specify to Cassandra that I want to retrieve all columns for the matching rows?

+3  A: 

How about

$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', standard => 1);

standard => 1 will force Net::Cassandra::Easy to use a slice predicate that matches all columns in the family.

rjh
Excellent! Exactly what I was looking for! Thanks!
knorv