我正在尝试使用 timeuuid 值执行准备好的语句并获得“无效值类型”异常。
这是代码:
$builder = \Cassandra::cluster();
$cluster = $builder->withContactPoints('127.0.0.1')
->build();
$session = $cluster->connect();
$preparedStatement = $session->prepare("SELECT * FROM test.timeuuid_test WHERE account_id = :accId and item_time_uid >= minTimeuuid(:minTime);");
$options = new ExecutionOptions([
'arguments' => [
'accId' => 1234,
'minTime' => new \Cassandra\Timeuuid(1458118516)
]
]);
$session->execute($preparedStatement, $options);
我得到以下异常:
“Cassandra\Exception\InvalidArgumentException:无效的值类型”
这是表格方案:
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 };
CREATE TABLE test.timeuuid_test (
account_id int,
item_time_uid timeuuid,
PRIMARY KEY ((account_id), item_time_uid)
) WITH CLUSTERING ORDER BY (item_time_uid DESC);
我究竟做错了什么?
我正在使用 PECL cassandra 1.1.0 和 cassandra 2.0.15:
安装的cassandra相关包:cassandra20-2.0.15-1.noarch cassandra-cpp-driver-2.2.2-1.el6.x86_64 cassandra-cpp-driver-devel-2.2.2-1.el6.x86_64