Datastax Cassandra PHP 驱动程序:"Invalid value type" 在准备好的语句中使用 timeuuid 时出现异常
Datastax Cassandra PHP Driver: "Invalid value type" exception when using timeuuid in prepared statement
我正在尝试使用 timeuuid 值执行准备好的语句并得到 "Invalid value type" 异常。
代码如下:
$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 : Invalid value type"
这里是table方案:
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
您将错误的类型绑定到 minTime
:minTimeUuid
采用 timestamp
参数,而不是 timeuuid
。
我正在尝试使用 timeuuid 值执行准备好的语句并得到 "Invalid value type" 异常。
代码如下:
$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 : Invalid value type"
这里是table方案:
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
您将错误的类型绑定到 minTime
:minTimeUuid
采用 timestamp
参数,而不是 timeuuid
。