[
https://issues.apache.org/jira/browse/CASSANDRA-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095656#comment-13095656
]
Jonathan Ellis commented on CASSANDRA-2474:
-------------------------------------------
That's a good start. I have two suggestions:
- we probably don't want the colons in the default aliases
- it would be good to make composite columns less of a special case. Instead
of "column" for a normal column and "parent/column" for supercolumns and
"component1..componentN" for composite, use component1 for normal, component1/2
for super, component1/N for composite.
So we'd end up with
{code}
SELECT component1 AS date, value AS price
FROM stockhist
WHERE symbol='GOOG'
AND date >= '2011-01-02'
LIMIT 50
{code}
(I think we could put this in column_metadata, too:
column_metadata=[{component1_alias: 'date', value_alias: 'price', ...}].
Thinking out loud here... let's save that for later if we do it at all.)
Composite columns are tricky because there's more than one way to "encode"
data. Consider screenshot-2, illustrating the twitter timeline example from
earlier. This shows 3 ways of encoding the same data; first as supercolumns,
then as two different composite column encodings. The supercolumn and first
composite encoding would look like this:
{code}
SELECT component1 AS tweet_id, username, value AS body
FROM timeline
WHERE user_id = '95a789a'
{code}
The second composite encoding though would be
{code}
SELECT component1 AS tweet_id, component2 AS username, value AS body
FROM timeline
WHERE user_id = '95a789a'
{code}
(Note that the first composite encoding is sparse, like the supercolumn
version. The second is dense. This means that it's more fragile when it comes
to extending it -- if I wanted to add a location tweet field, I'd need to
delete (e.g.) the 2e1c3308,cscotta column and replace it with
2e1c3308,cscotta,<location>. So, generally not recommended... but the
composite column spec implies we should support it.)
Which brings us to: how to deal with insert/update in composite columns.
> CQL support for compound columns
> --------------------------------
>
> Key: CASSANDRA-2474
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2474
> Project: Cassandra
> Issue Type: Sub-task
> Components: API, Core
> Reporter: Eric Evans
> Assignee: Pavel Yaskevich
> Labels: cql
> Fix For: 1.0
>
> Attachments: screenshot-1.jpg, screenshot-2.jpg
>
>
> For the most part, this boils down to supporting the specification of
> compound column names (the CQL syntax is colon-delimted terms), and then
> teaching the decoders (drivers) to create structures from the results.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira