You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class PandraClauseInAddon extends PandraClauseIn {
public function match($value) {
// you can implement here your matching logic
return ( in_array($value, $this->getValueIn()) );
}
}
And then apply the plugin to a key name array to retrieve all keys
$matches=$someSuperColumn->getColumn(
new PandraClauseInAddon(
array_keys( $myArrayKeyValues ) )
);
// 2. Slicing - you'love it! Look at Pandra Examples
NOTE: Due to a bug in previous 0.6.3 Cassandra binaries , you've got an error if you don't specifiy 'start' and 'finish' values when comparing UUID types (CompareWith="TimeUUIDType"). That (fixed) bug described here: https://issues.apache.org/jira/browse/CASSANDRA-377
// 3. Iterating over columns to match inner values. I really hate this!
$subColumns=$col->getColumns(); // get sub - columns
foreach($subColumns as $sub) {
if ( in_array($sub->getValue(),$myArrayKeyValues) ) {
// found some item
}
}
// Best ways to match values / retrieve keys using great Pandra functionalities?
The text was updated successfully, but these errors were encountered:
foreach($res as $k => $v) { // columns
foreach($v->columns as $col) {
if(!empty($col->column->value))
$keys[]=$col->column->value;
}
$preResult = PandraCore::getCFSliceMulti(
'myNS',
$keys,
new cassandra_ColumnParent(array(
'column_family' => 'myCF',
)),
new PandraSlicePredicate(
PandraSlicePredicate::TYPE_RANGE,
array('start' => '',
'finish' => '',
'count' => $maxRows,
'reversed' => true))
);
} // end cols
In this way you are doing a query based on keys slice,
then having a list of keys, you can perform a multi_slice query,
much better than a simple slice query.
I'm a newbie to Pandra.
How about data retrieval?
I'm using these techniques by now:
Suppose to have this array
$myArrayKeyValues = array(
'key1' => 'val1',
'key2' => 'val2',
);
// 1. Clause plugins extensions
And then apply the plugin to a key name array to retrieve all keys
// 2. Slicing - you'love it! Look at Pandra Examples
NOTE: Due to a bug in previous 0.6.3 Cassandra binaries , you've got an error if you don't specifiy 'start' and 'finish' values when comparing UUID types (CompareWith="TimeUUIDType"). That (fixed) bug described here: https://issues.apache.org/jira/browse/CASSANDRA-377
// 3. Iterating over columns to match inner values. I really hate this!
// Best ways to match values / retrieve keys using great Pandra functionalities?
The text was updated successfully, but these errors were encountered: