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

Sorting results when using IN()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.1.3
    • None

    Description

      Using the following test schema:

      CREATE TABLE test (
      my_id varchar,
      time_id uuid,
      value int,
      PRIMARY KEY (my_id, time_id)
      );

      When you issue a CQL3 query like:
      select * from test where my_id in('key1', 'key2') order by time_id;

      You receive the error:
      "Ordering is only supported if the first part of the PRIMARY KEY is restricted by an Equal"

      I'm including a patch I put together after spending an hour or two poking thru the code base that sorts the results for these types of queries. I'm hoping someone with a deeper understanding of Cassandra's code base can take a look at it, clean it up or use it as a starting place, and include it in an upcoming release.

      Attachments

        1. CASSANDRA-4327.patch
          7 kB
          Pavel Yaskevich
        2. CASSANDRA-4327-v2.patch
          7 kB
          Pavel Yaskevich
        3. trunk-4327.txt
          4 kB
          Stephen Powis

        Activity

          People

            xedin Pavel Yaskevich
            stephen.powis Stephen Powis
            Pavel Yaskevich
            Jonathan Ellis
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: