我在 cassandra 中有一个键空间,其列族(让 A)具有复合键另一个列族(让 B)我正在存储存在于 A 列族中的确切行数。当我使用 multiget 获取数据时,它没有给出实际的排序数据。
A: [1] = 13;
B:
[6014:2:0] = "aaaaaa";
[6014:2:1] = "bbbbbb";
[6014:2:2] = "cccccc";
[6014:2:3] = "dddddd";
[6014:2:4] = "eeeeee";
[6014:2:5] = "ffffff";
[6014:2:6] = "gggggg";
[6014:2:7] = "hhhhhh";
[6014:2:8] = "iiiiii";
[6014:2:9] = "jjjjjj";
[6014:2:10] = "kkkkkkk";
[6014:2:11] = "lllllll";
[6014:2:12] = "mmmmmmm";
我的代码
require_once(__DIR__.'/phpcassa/lib/autoload.php');
use phpcassa\Connection\ConnectionPool;
use phpcassa\ColumnFamily;
use phpcassa\SystemManager;
use phpcassa\Schema\StrategyClass;
$connection = new ConnectionPool('KEYSPACE', array('XXXX', 'YYYY', 'ZZZZ'));
$numDtls = new ColumnFamily($connection, 'A');
$key = 1;
$num_details = $numDtls->get($key);
$num = $num_details;
$json = '';
$key_array = array();
if(isset($num)){
$str = new ColumnFamily($connection, 'B');
for($i = 0;$i <= $num; $i++){
$key_array[] = array($table, $flag, $i);
}
$detail = $str->multiget($key_array);
$json = json_encode($detail);
}
它给出的输出为
6014:2:0
6014:2:6
6014:2:9
6014:2:11
6014:2:4
6014:2:1
6014:2:12
6014:2:8
6014:2:7
6014:2:10
6014:2:3
6014:2:5
6014:2:2
它以混乱的顺序给出输出......如何以排序方式获得?以及如何获得超过 100 行?