cassandra how can I sort from udt frozen

Viewed 54

is that possible to use clustering key for a frozen column ?

Maybe:

CREATE TYPE user_details (
  email varchar,
  password varchar,
  createdAt timestamp
)

CREATE TABLE users (
  user_id uuid,
  user_information user_details,
)

How can I sort now from createdAt column ?

1 Answers

You can't do that - you will need to make createdAt a regular column to be able to use it as clustering key.

But in reality, why do you need UDT here at all? It's simple structure, that should perfectly work as regular columns. The only thing that I'm thinking about is when the same UDT is used in multiple tables. But by using UDT you potentially get a lot of problems - for example, UDTs are specific to keyspace where they are defined, so you can't restore backup into another keyspace, etc.

Related