Domanda

I'm trying to change the type of a column from UUID to TIMEUUID, but I'm unable to do so.

ALTER TABLE Person ALTER KEY TYPE timeuuid;

Error:

Bad Request: Cannot change key from type uuid to type timeuuid: types are incompatible.

Any idea on how to achieve this without losing the data from the column family?

È stato utile?

Soluzione

It is not allowed. This is because TimeUUIDs have a different sorting pattern than regular UUIDs so Cassandra does not allow this. If you don't care about Columns being sorted by time, you can generate and use TimeUUID in your application without changing the column type in Cassandra, but the sorting may be out of order if mixed with those existing columns. If you absolutely need to do this, your only option would be to migrate your existing data and change its columns to UUID to a new column family.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top