Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-11339

WHERE clause in SELECT DISTINCT can be ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.2.x, 3.11.5
    • Legacy/CQL
    • None
    • Normal

    Description

      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

      Attachments

        Activity

          People

            ifesdjeen Alex Petrov
            philipthompson Philip Thompson
            Alex Petrov
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: