It’s not possible to search a record when the key is a Timeuuid value. For example the URL
http://192.168.1.1/api/v2/cassandra_db/_table/test_table/af45eab0-5364-11e8-a43b-93f2b8ecce07
returns the following error:
'TIME UUID type can only be set with null, or seconds, or valid formatted time.'
The problem is that the file df-cassandra/src/Database/Schema/Schema.php only allow to create Timeuuid from integers and dates. The problem here is that Timeuuids for the same timestamp but generated on different machines are different because of the mac address part, therefore a record can’t be found if the timeeuid was generated in another machine.
case DbSimpleTypes::TYPE_TIME_UUID:
if (is_numeric($value)) {
return new \Cassandra\Timeuuid((int)$value); // must be seconds
} elseif (empty($value) || (0 === strcasecmp($value, 'now()'))) {
return new \Cassandra\Timeuuid();
} elseif (false !== $seconds = strtotime($value)) {
return new \Cassandra\Timeuuid($seconds);
} else {
throw new BadRequestException('TIME UUID type can only be set with null, or seconds, or valid formatted time.');
}
break;
There were a known limitation to generate a Timeuuid from a string representation in the Cassandra PHP driver but it was solved in 2017 (See: https://github.com/datastax/php-driver/pull/113/files). The problem is solved with the following code:
case DbSimpleTypes::TYPE_TIME_UUID:
if (is_numeric($value)) {
return new \Cassandra\Timeuuid((int)$value); // must be seconds
} elseif (empty($value) || (0 === strcasecmp($value, 'now()'))) {
return new \Cassandra\Timeuuid();
} elseif (false !== $seconds = strtotime($value)) {
return new \Cassandra\Timeuuid($seconds);
} else {
// UPDATE THIS LINE
return new \Cassandra\Timeuuid($value);
}
break;
Hope it helps.
Regards
It’s not possible to search a record when the key is a Timeuuid value. For example the URL
returns the following error:
The problem is that the file
df-cassandra/src/Database/Schema/Schema.phponly allow to create Timeuuid from integers and dates. The problem here is that Timeuuids for the same timestamp but generated on different machines are different because of the mac address part, therefore a record can’t be found if the timeeuid was generated in another machine.There were a known limitation to generate a Timeuuid from a string representation in the Cassandra PHP driver but it was solved in 2017 (See: https://github.com/datastax/php-driver/pull/113/files). The problem is solved with the following code:
Hope it helps.
Regards