Alexandre S.
Alexandre S.

Reputation: 540

Partition key with UDT field in CQL

I have a little question concerning the partition key in Cassandra. When I create a table which contain a field called flxB whose type is an UDT like this :

CREATE TYPE fluxes (
    flux float,
    flux_prec smallint,
    flux_error float,
    flux_error_prec smallint,
    flux_bibcode text,
    system text
);

Can I put the field flxB.flux in my partition key ?

Upvotes: 0

Views: 523

Answers (1)

Ashraful Islam
Ashraful Islam

Reputation: 12850

No, you can't put flxB.flux on any part of primary key

Even In cassandra version lower than 3.0 UDT type field must be defined as frozen

When using the frozen keyword, you cannot update parts of a user-defined type value. The entire value must be overwritten. Cassandra treats the value of a frozen, user-defined type like a blob.

In Cassandra all the part of the primary key must be present when inserting/updating, If cassandra would allow you to put flx.flux in partition key, How cassandra will make sure all the part of the primary key is present in the insert/update query ?

Upvotes: 0

Related Questions