Book Image

Learning Apache Cassandra

By : Matthew Brown
4 (1)
Book Image

Learning Apache Cassandra

4 (1)
By: Matthew Brown

Overview of this book

Table of Contents (19 chapters)
Learning Apache Cassandra
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 8. Collections, Tuples, and User-defined Types

In the preceding chapters, we focused largely on the high-level structure of Cassandra tables, and particularly on the forms and uses of primary keys. We paid scant attention to data columns, generally defining our table schemas with one or two text columns at most. While this type of scalar data column is the workhorse of Cassandra schemas, they're not the only arrow in Cassandra's quiver.

Cassandra offers three different structures that store multiple values in a single column. Collection columns can store an arbitrary number of values, all of the same type. Tuples and user-defined types store a fixed number of values but these values can be of different types. While the fields in a tuple are specified by position, user-defined types give a name to each field; when reading data from a user-defined type, it's possible to retrieve a subset of the fields within the column.

Collections come in three flavors: lists, sets, and maps. Set columns...