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

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

bq. SELECT transposed(column) FROM foo WHERE key=X

Can we just write transposed() then instead of implying that there's actually a 
single column we're doing this to?

bq. You could then also do supercol slices like transposed(column, start, end)

This isn't much of an improvement over the old slice syntax, from a CQL 
perspective.  Here's why.  If we have "real" WHERE clauses we get all the 
benefits of regularity that implies: we can get "traditional" slices

{code}
SELECT transposed() FROM foo WHERE key=X AND column >= X AND column <= Y
{code}

Or "paging" style (start-exclusive), possibly the single most-requested slicing 
feature:
{code}
SELECT transposed() FROM foo WHERE key=X AND column > X AND column <= Y
{code}

No special syntax needed for count(), other than I'm not sure we want to go 
full-on subquery here.  The HQL options don't look great.  Maybe we just add a 
transposed_count() function too):
{code}
SELECT count(*) FROM
(SELECT transposed() FROM foo WHERE key=X AND column > X AND column <= Y)
{code}

More natural support for just once slice "endpoint":
{code}
SELECT transposed() FROM foo WHERE key=X AND column >= X
{code}

Multi-row slicing:
{code}
SELECT transposed() FROM foo WHERE key IN (X, Y) AND column >= X AND column <= Y
{code}

Multi-slice from single row (CASSANDRA-2710):
{code}
SELECT transposed() FROM foo WHERE key=X AND ((column >= X AND column <= Y) OR 
(column >= A AND column <= B))
{code}

Composite column support (i.e., first-part-of-column-name is exactly X):
{code}
SELECT transposed() FROM foo WHERE key=X AND column=X
{code}

Future proof against hypothetical future CQL support for functions:
{code}
SELECT transposed() FROM foo WHERE key=X AND sqrt(column) < X
{code}

... and of course combinations of the above.  Adding functions for even just 
the examples here would be ugly, let alone further mix-and-matching.

> 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
>              Labels: cql
>             Fix For: 1.0
>
>
> 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

        

Reply via email to