[ 
https://issues.apache.org/jira/browse/CASSANDRA-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171304#comment-13171304
 ] 

Jonathan Ellis commented on CASSANDRA-2474:
-------------------------------------------

How about this?

{noformat}
CREATE TABLE timeline (
    userid int primary key,
    posted_at uuid,
    posted_by int,
    body text
) TRANSPOSED AS (posted_at), SPARSE(posted_by, body);
{noformat}

SELECT, INSERT, and UPDATE syntax requires no changes.

The SPARSE keyword means this is a "dynamic" composite column.  Thus, the 
actual composite columns stored here might be 
{(08ec87a0-2cc3-4982-a0e7-a434884451f8, 'posted_by'): 524342} and 
{(08ec87a0-2cc3-4982-a0e7-a434884451f8, 'body'): 'CQL FTW'}. That is, the 
column name literals 'posted_by' and 'body' are part of the composite column 
name.  It will take one composite column per SPARSE column to store a 
transposed row.

{{ALTER TABLE timeline ADD location int;}} would add location to the sparse 
subcolumns.

{noformat}
CREATE TABLE events (
    series text primary key,
    ts1 int,
    cat text,
    subcat text,
    id uuid
) TRANSPOSED AS (ts1, cat, subcat, id);
{noformat}

There are no sparse components; an example column stored might be (2355234412, 
'trucks', 'Ford', 2165cd4c-4db8-4a8f-a2b2-e8fa157f7697).  Each transposed row 
is represented by one column.  {{ALTER TABLE events}} would not be allowed.

                
> CQL support for compound columns
> --------------------------------
>
>                 Key: CASSANDRA-2474
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2474
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API, Core
>            Reporter: Eric Evans
>            Assignee: Pavel Yaskevich
>              Labels: cql
>             Fix For: 1.1
>
>         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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to