Currently CQL3 have a nice syntax for using composites in the column name (it's more than that in fact, it creates a whole new abstraction but let's say I'm talking implementation here). There is however 2 other place where composites could be used (again implementation wise): the row key and the column value. This ticket proposes to explore which of those make sense for CQL3 and how.
For the row key, I really think that CQL support makes sense. It's very common (and useful) to want to stuff composite information in a row key. Sharding a time serie (
CASSANDRA-4176) is probably the best example but there is other.
For the column value it is less clear. CQL3 makes it very transparent and convenient to store multiple related values into multiple columns so maybe composites in a column value is much less needed. I do still see two cases for which it could be handy:
- to save some disk/memory space, if you do know it makes no sense to insert/read two value separatly.
- if you want to enforce that two values should not be inserted separatly. I.e. to enforce a form of "constraint" to avoid programatic error.
Those are not widely useful things, but my reasoning is that if whatever syntax we come up for "grouping" row key in a composite trivially extends to column values, why not support it.
As for syntax I have 3 suggestions (that are just that, suggestions):
- If we only care about allowing grouping for row keys:
- A syntax that could work for both grouping in row key and colum value:
- An alternative to the preceding one: