Cassandra: change type from UUID to TIMEUUID
Asked Answered
P

1

1

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?

Phrasal answered 3/2, 2014 at 17:52 Comment(0)
V
2

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.

Vespertilionine answered 3/2, 2014 at 23:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.