I am using the User Defined Types in CQL 3.1 (cqlsh info below):
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
I have created the following user-defined type (simplified here for demonstration purposes):
create type fullname ( firstname text, lastname text );
I then created a table that includes a set of type fulsome:
create table people ( id UUID primary key, names set < frozen <fullname>> );
I can insert rows into the table using:
insert into people (id, names) values (
now(),
{{firstname: 'Jim', lastname: 'Jones'}}
);
The result looks good:
select * from people;
id | names
--------------------------------------+-----------------------------------------
69ba9d60-a06b-11e4-9923-0fa29ba414fb | {{firstname: 'Jim', lastname: 'Jones'}}
My question is this: how do I fetch all of the first name entries? If I was not using set, and just fullname, I could use the dot notation:
select name.firstname from people;
But that obviously doesn't work, because I am using a set. In normal usage (without a UDT), a set would never have need for dot notation, because all of the entries would be of a simple type (text, UUID, etc). I tried using all of the usual suspects from other programming languages...
select names.firstname...
select names[].firstname...
select names['firstname']...
About the only information on UDT's on the web is from the DataStax web site, which doesn't get into this use case.
Anybody tried this before? Or is what I am doing just plain not allowed?
Thanks,
John