1

我正在尝试将数据存储到 cassandra 中,并按时间排序。使用 TimeUUIDType 作为键时遇到问题。

phpcassa 出现以下错误...

Fatal error: Uncaught exception 'cassandra_InvalidRequestException' 
with message 'TimeUUID   should be 16 or 0 bytes (6)'

调用插入方法时会发生这种情况...

$pool = new ConnectionPool("Keyspace1", array("localhost:9160"));
$column_family = new ColumnFamily($pool, 'users');
$column_family->insert(CassandraUtil::uuid1(), array('name' => 'value'));

我使用 cassandra-cli 使用以下命令创建了一个测试表...

CREATE COLUMN FAMILY users WITH comparator = TimeUUIDType;
4

1 回答 1

1

comparator适用于列名,而不是行键。如果您希望行键为 TimeUUID,则应key_validation_class改为设置。

您收到此异常是因为 Cassandra 需要 TimeUUID 作为列名,但您传递的是普通字符串。

于 2011-12-18T17:25:02.423 回答