문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top