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

ORDER BY should allow skipping equality-restricted clustering columns

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 4.0-alpha1, 4.0
    • Legacy/CQL
    • None

    Description

      Given a table like the following:

      CREATE TABLE foo (a int, b int, c int, d int, PRIMARY KEY (a, b, c));
      

      We should support a query like this:

      SELECT * FROM foo WHERE a = 0 AND b = 0 ORDER BY c ASC;
      

      Currently, this results in the following error:

      [Invalid query] message="Order by currently only support the ordering of columns following their declared order in the PRIMARY KEY"
      

      However, since b is restricted by an equality restriction, we shouldn't require it to be present in the ORDER BY clause.

      As a workaround, you can use this query instead:

      SELECT * FROM foo WHERE a = 0 AND b = 0 ORDER BY b ASC, c ASC;
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            adelapena Andres de la Peña Assign to me
            thobbs Tom Hobbs
            Andres de la Peña
            Benjamin Lerer
            Tom Hobbs Tom Hobbs
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment