Benjamin Lerer created CASSANDRA-13017:
------------------------------------------

             Summary: DISTINCT queries on partition keys and static column 
might not return all the results
                 Key: CASSANDRA-13017
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13017
             Project: Cassandra
          Issue Type: Bug
          Components: CQL
            Reporter: Benjamin Lerer
            Assignee: Benjamin Lerer
             Fix For: 2.1.x, 2.2.x


In {{2.1}} and {{2.2}}, a {{DISTINCT}} query on partition keys and static 
columns might not return all the data if some rows have no data and the static 
columns have also no values.

The problem can be reproduced using the Java driver with the following code:
{code}
        session = cluster.connect();
        session.execute("CREATE KEYSPACE IF NOT EXISTS test WITH REPLICATION = 
{'class' : 'SimpleStrategy', 'replication_factor' : '1'}");
        session.execute("USE test");
        session.execute("DROP TABLE IF EXISTS test");
        session.execute("CREATE TABLE test (pk int, c int, v int, s int static, 
primary key(pk, c))");

        PreparedStatement prepare = session.prepare("INSERT INTO test (pk, c, 
v, s) VALUES (?, ?, ?, ?)");

        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 1; j++)
                session.execute(prepare.bind(i, j, null, null));

        for (Row row : session.execute(new SimpleStatement("SELECT DISTINCT 
token(pk), pk, s FROM test").setFetchSize(2)))
        {
            System.out.println(row);
        }
{code} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to