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

Benjamin Lerer commented on CASSANDRA-14808:
--------------------------------------------

C* does not support it for now. It should not be too difficult to support it, 
in my opinion. 

> Support ORDER BY with 2ndary Indexes
> ------------------------------------
>
>                 Key: CASSANDRA-14808
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14808
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>         Environment: Apache Cassandra 3.11.3
>            Reporter: Yan Yao
>            Priority: Major
>             Fix For: 3.11.4, 4.0
>
>
>  Suppose we have a generic table:
> {code:java}
> CREATE TABLE base_table(
>     partition1 uuid,
>     ...
>     partitionN uuid,
>     static_column text static,
>     clustering1 uuid,
>     ...
>     clusteringM uuid,
>     regular text,
>     list_text list,
>     set_text set,
>     map_int_text map<int, text>,
>     PRIMARY KEY((partition1, ..., partitionN), clustering1, ... , clusteringN)
> );
> {code}
>  
> And create an index on _regular text_ column, the schema of the index table 
> will be:
> {code:java}
> CREATE TABLE regular_idx(
>     regular text,
>     partitionColumns blob,
>     clustering1 uuid,
>     ...
>     clusteringM uuid,
>     PRIMARY KEY((regular), partitionColumns, clustering1, ..., clusteringM)
> );
> {code}
>  
> Then it's possible to execute queries like:
> {code:java}
> SELECT * FROM base_table WHERE regular = <some_value_0> AND partition1 = 
> <some_value_1> AND ... AND partitionN = <some_value_N> ORDER BY 
> clustering1;{code}
>  
> However, CQL3 would check if the _secondary index_ is used WITH _order by_ 
> during prepare a select statement, and throw an exception at once for queries 
> like above. 
> Could we support ORDER BY with 2ndary Indexes at least for above query 
> pattern?   
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to