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

Sylvain Lebresne commented on CASSANDRA-11339:
----------------------------------------------

I think for now we just want to reject {{DISTINCT}} queries with a {{WHERE}} 
clause. {{DISTINCT}} can currently only select the partition key (and 
optionally static columns) so filtering on other columns doesn't feel terribly 
useful to me in the first place. But even if we want to allow it someday, it's 
quite a bit involved so the priority should be to fix the clearly incorrect 
validation.

> WHERE clause in SELECT DISTINCT can be ignored
> ----------------------------------------------
>
>                 Key: CASSANDRA-11339
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11339
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Philip Thompson
>            Assignee: Alex Petrov
>             Fix For: 2.1.x
>
>
> I've tested this out on 2.1-head. I'm not sure if it's the same behavior on 
> newer versions.
> For a given table t, with {{PRIMARY KEY (id, v)}} the following two queries 
> return the same result:
> {{SELECT DISTINCT id FROM t WHERE v > X ALLOW FILTERING}}
> {{SELECT DISTINCT id FROM t}}
> The WHERE clause in the former is silently ignored, and all id are returned, 
> regardless of the value of v in any row. 
> It seems like this has been a known issue for a while:
> http://stackoverflow.com/questions/26548788/select-distinct-cql-ignores-where-clause
> However, if we don't support filtering on anything but the partition key, we 
> should reject the query, rather than silently dropping the where clause



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

Reply via email to