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

Force provided columns in clustering key order in 'CLUSTERING ORDER BY'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 1.2.0 beta 2
    • None
    • None
    • Normal

    Description

      Using this table:
      CREATE TABLE video_event (
      videoid_username varchar,
      event varchar,
      event_timestamp timestamp,
      video_timestamp timestamp,
      PRIMARY KEY (videoid_username, event, event_timestamp)
      )WITH CLUSTERING ORDER BY (event_timestamp DESC);

      Inserting these records:

      INSERT INTO video_event (videoid_username, event, event_timestamp, video_timestamp)
      VALUES ('99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd','start','2012-09-02 18:05:00','2012-09-02 18:05:00');
      INSERT INTO video_event (videoid_username, event, event_timestamp, video_timestamp)
      VALUES ('99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd','stop','2012-09-02 18:05:30','2012-09-02 18:05:30');
      INSERT INTO video_event (videoid_username, event, event_timestamp, video_timestamp)
      VALUES ('99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd','start','2012-09-02 18:35:00','2012-09-02 18:35:00');
      INSERT INTO video_event (videoid_username, event, event_timestamp, video_timestamp)
      VALUES ('99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd','stop','2012-09-02 18:37:30','2012-09-02 18:37:30');

      Running this select:

      select * from video_event where videoid_username = '99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd' limit 1;

      I get this:

      videoid_username | event | event_timestamp | video_timestamp
      ------------------------------------------------------------------------+-------------------------
      99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd | start | 2012-09-02 18:05:00+0000 | 2012-09-02 18:05:00+0000

      I would expect to see this:

      videoid_username | event | event_timestamp | video_timestamp
      ------------------------------------------------------------------------+-------------------------
      99051fe9-6a9c-46c2-b949-38ef78858dd0:ctodd | stop | 2012-09-02 18:37:30+0000 | 2012-09-02 18:37:30+0000

      where the first record pulled was the sorted record by event_timestamp in reverse order.

      Attachments

        1. 4881.txt
          3 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            pmcfadin Patrick McFadin
            Sylvain Lebresne
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: