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

DISTINCT queries on partition keys and static column might not return all the results

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 2.1.17, 2.2.9
    • Component/s: Legacy/CQL
    • Labels:
      None
    • Severity:
      Normal

      Description

      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:

              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);
              }
      

        Attachments

          Activity

            People

            • Assignee:
              blerer Benjamin Lerer
              Reporter:
              blerer Benjamin Lerer
              Authors:
              Benjamin Lerer
              Reviewers:
              Tom Hobbs
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: