kallaspriit/Cassandra-PHP-Client-Library — Issue #10: Cassandra::getWhere causes cassandra_InvalidRequestException
Author: Mark-K
Created: 2011-12-06 07:33:53+00:00
State: open

A cassandra_InvalidRequestException occurs in Cassandra::getWhere() when using where array format #2.
Using:
apache-cassandra-1.0.5
Cassandra-PHP-Client-Library (2011-12-04)
PHP 5.3.8

(I'm new to both PHP and Cassandra and so could be overlooking something obvious.)

Except from Cassandra.php:
* The where array can be a mix of two formats:
* 1. For simplest equality comparison - column value must equal something
* exactly, the format array('column-name' => 'required value') can be
* used.
* 2. For any other supported comparison operators, use the slightly longer
* syntax array(array('column-name', Cassandra::OP_LT, 'value')) where
* each component is an array with three values, the first one being the
* column name, second comparison operator and third the value. Use the
* Cassandra::OP_.. constants for operators.
* You can mix the two variants.

Added to example.php (at line 193):
$aged24andOlder = $cassandra->cf('user')->getWhere(
array(array('age', Cassandra::OP_GTE, 24))
);
echo 'Users aged 24+:

'.print_r($aged24andOlder->getAll(), true).'

';

Exception:
Fatal error: Uncaught exception 'cassandra_InvalidRequestException' in /usr/local/php/lib/php/Cassandra/thrift/packages/cassandra/Cassandra.php:4286
Stack trace:
#0 /usr/local/php/lib/php/Cassandra/thrift/packages/cassandra/Cassandra.php(587): cassandra_Cassandra_get_indexed_slices_result->read(Object(TBinaryProtocolAccelerated))
#1 /usr/local/php/lib/php/Cassandra/thrift/packages/cassandra/Cassandra.php(545): cassandra_CassandraClient->recv_get_indexed_slices()
#2 [internal function]: cassandra_CassandraClient->get_indexed_slices(Object(cassandra_ColumnParent), Object(cassandra_IndexClause), Object(cassandra_SlicePredicate), 1)
#3 /usr/local/php/lib/php/Cassandra/Cassandra.php(968): call_user_func_array(Array, Array)
#4 /usr/local/php/lib/php/Cassandra/Cassandra.php(3621): Cassandra->call('get_indexed_sli...', Object(cassandra_ColumnParent), Object(cassandra_IndexClause), Object(cassandra_SlicePredicate), 1)
#5 /usr/local/php/lib/ph in /usr/local/php/lib/php/Cassandra/Cassandra.php on line 976