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

Benjamin Lerer commented on CASSANDRA-11310:
--------------------------------------------

Thanks for the initial patch. Overall, I think that you are going in the right 
direction.

While reviewing your patch I realised that some part of the code are really 
confusing. I opened CASSANDRA-11354 for improving the code of 
{{PrimaryKeyRestrictions}}.
In  {{PrimaryKeyRestrictions}} your changes looks good. Your changes in the 
constructor will also change the behavior 
for some secondary index requests. Queries like: {{SELECT * FROM myTable WHERE 
pk = 1 and clustering1 > 1 AND clustering2 > 1 AND x = 'test' ALLOW FILTERING}} 
used to be rejected and will now be accepted. It might be good if you could add 
some tests for that.

In my opinion, the {{useFiltering}} name is a bit confusing we should use 
{{allowFiltering}} instead as what the variable means is that the request had 
{{ALLOW FILTERING}} specified.

In {{StatementRestrictions}} some stuff looks wrong to me.
* In {{processClusteringColumnsRestrictions}} the fact that we set 
{{useSecondaryIndex}} to {{true}} if we allow filtering does not make sense. I 
am also not sure why we do it for views ([~thobbs] is there a good reason?).
* Instead of modifying {{getRowFilter}, I think that you should add 
{{clusteringColumnsRestrictions}} to {{indexRestrictions}} if filtering is 
allowed and some clustering columns restrictions require filtering.
* It might makes sense to rename {{indexRestrictions}} into 
{{filteringRestrictions}}.  

For {{CONTAINS}} restrictions I was thinking of {{CONTAINS}} restrictions on 
the Clustering columns. 

  


> 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.x
>
>
> 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)

Reply via email to