cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-11310) Allow filtering on clustering columns for queries without secondary indexes
Date Mon, 18 Apr 2016 20:40:25 GMT

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

Alex Petrov commented on CASSANDRA-11310:
-----------------------------------------

I've found one place where {{ALLOW FILTERING}} discards {{usesSecondaryIndexing}} in {{StatementRestrictions}}:
in {{processClusteringColumnRestrictions}} when checking for {{clusteringColumns}}. 

>From the example given by Sam: 

{code}
createTable("CREATE TABLE %s (a text, b int, c text, d int, PRIMARY KEY (a, b, c));");
execute("CREATE CUSTOM INDEX ON %s (inber) USING 'org.apache.cassandra.index.sasi.SASIIndex'");

execute("SELECT * FROM %s WHERE a='R1' AND b > 0 AND c = 'int1' ALLOW FILTERING ;");
{code}

in {{processClusteringColumnRestrictions}} we're checking only the order of columns: if the
columns are out of order, we set {{usesSecondaryIndexing}}. Although that's not the only case.
If {{b}} is restricted with slice and {{c}} with {{EQ}}, the order is technically correct
(both {{b}} and {{c}} are restricted), although since {{b}} is restricted with slice, we have
to set the {{usesSecondaryIndexing}} to true.

I've implemented a fast prototype locally and it seems to fit both cases. I can make it prettier
and show tomorrow morning.

> Allow filtering on clustering columns for queries without secondary indexes
> ---------------------------------------------------------------------------
>
>                 Key: CASSANDRA-11310
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11310
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: Benjamin Lerer
>            Assignee: Alex Petrov
>              Labels: doc-impacting
>             Fix For: 3.6
>
>
> Since CASSANDRA-6377 queries without index filtering non-primary key columns are fully
supported.
> It makes sense to also support filtering on clustering-columns.
> {code}
> CREATE TABLE emp_table2 (
> empID int,
> firstname text,
> lastname text,
> b_mon text,
> b_day text,
> b_yr text,
> PRIMARY KEY (empID, b_yr, b_mon, b_day));
> SELECT b_mon,b_day,b_yr,firstname,lastname FROM emp_table2
> WHERE b_mon='oct' ALLOW FILTERING;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message