2
有沒有什麼辦法從cassandra通過phpcassa
使用子句獲取數據?從cassandra使用子句獲取數據
我需要選擇所有行,其中sum<10
。例如,phpcassa get_range()
中的函數僅選擇等於某些值的行。通常用PHPCassa
有沒有什麼辦法從cassandra通過phpcassa
使用子句獲取數據?從cassandra使用子句獲取數據
我需要選擇所有行,其中sum<10
。例如,phpcassa get_range()
中的函數僅選擇等於某些值的行。通常用PHPCassa
,你會使用索引:
按http://thobbs.github.com/phpcassa/tutorial.html //
略有提高:<?php
$column_family = new ColumnFamily($conn, 'Indexed1');
$index_exp_eq = CassandraUtil::create_index_expression('gender', 'male', $op='EQ');
$index_exp_gt = CassandraUtil::create_index_expression('sum', 10, $op='GT');
$index_clause = CassandraUtil::create_index_clause(array($index_exp_eq, $index_exp_gt));
$rows = $column_family->get_indexed_slices($index_clause);
// returns an Iterator over:
// array('winston smith' => array('birthdate' => 1984))
foreach($rows as $key => $columns) {
// Do stuff with $key and $columns
Print_r($columns)
}
?>
隨着你的情況下,你不能簡單地與總和< 10單索引表達式.. 。您必須具有EQ運算符的第一個索引表達式以及其他運算符的後續索引表達式。
但如果沒有任何列,其等於任何數據我有? – Undrooleek
我發現溶液 需要有創建索引表達時使用'cassandra_IndexOperator' http://wiki.apache.org/cassandra/API – Undrooleek