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

Distributed tests can return ordering columns that have not been selected

    XMLWordPrintableJSON

Details

    Description

      The following test fails

      @Test
      public void incorrectClusteringColumnTest() throws IOException
      {
          try (Cluster cluster = init(Cluster.build(1).start()))
          {
              cluster.schemaChange(withKeyspace("CREATE TABLE %s.t (k int, c int, v int, primary key(k, c))"));
      
              cluster.coordinator(1).execute(withKeyspace("INSERT INTO %s.t (k, c, v) VALUES (0, 1, 2)"), ConsistencyLevel.QUORUM);
      
              String query = withKeyspace("SELECT v FROM %s.t WHERE k IN (0, 1) ORDER BY c LIMIT 10");
              assertRows(cluster.coordinator(1).execute(query, ConsistencyLevel.ONE), row(2));
          }
      }
       

      The query is returning the clustering column c as well as the regular column v.

      The reason for the extra column being returned is that the RowUtil is using ResultMessage.Rows.result.metadata.names instead on ResultMessage.Rows.result.metadata.requestNames(). This last method removes columns that have not been requested.

      Attachments

        Activity

          People

            mike_tr_adamson Mike Adamson
            mike_tr_adamson Mike Adamson
            Mike Adamson
            Andres de la Peña, Jeremiah Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: