Map pattern
Whenever there is a need to provide a mapping of keys to values as part of a record, use the Cassandra data type Map in the column family. The "as part of a record" part of preceding sentence is very important. This must not be misunderstood as any general lookup service of records such as the master tables in the RDBMS world.
Motivations/solutions
In the normalized RDBMS tables, whenever there is a need to provide a key to value mapping for an entity, the easiest and most straightforward approach is to create a small lookup table with the key as the primary key of the lookup table and the value as the non-primary key. Just like all the other patterns discussed in this chapter, the joins of the tables are required to get all the pieces of data together even here. All the perils of the table joins are applicable here too. Cassandra comes with a data type Map that can be used in the column families to solve this problem. This avoids the need to have joins and indexes to...