Reading discrete values from collections

The most powerful feature of CQL collections is the ability to write discrete values to a collection. It's possible to append a single value to a list, update a single key-value pair in a map, remove a specific value from a set, and so on.

At read time, however, there is no special support for reading discrete values. For instance, we might want to be able to do something like the following to read a specific element from a list column:

SELECT "shared_by"[2] FROM "user_status_updates" WHERE "username" = 'alice' AND "id" = 76e7a4d0-e796-11e3-90ce-5f98e903bf02; 

Or we might like to read the value at a specific key within a map column:

SELECT "social_identities"['twitter'] FROM "users" WHERE "username" ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.