Mike Adamson created CASSANDRA-18892:
----------------------------------------

             Summary: Distributed tests can return ordering columns that have 
not been selected
                 Key: CASSANDRA-18892
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18892
             Project: Cassandra
          Issue Type: Bug
          Components: Test/dtest/java
            Reporter: Mike Adamson
            Assignee: Mike Adamson


The following test fails
{code:java}
@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));
    }
}
 {code}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to