You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'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
The text was updated successfully, but these errors were encountered:
dss77
changed the title
Can't get a record with a TimeUUID value as primary key
Can't get a record by id when it has a TimeUUID value as primary key
May 10, 2018
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.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.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
The text was updated successfully, but these errors were encountered: