Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
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); }