Fix paging for DISTINCT queries on partition keys and static columns

patch by Benjamin Lerer; reviewed by Tyler Hobbs for CASSANDRA-13017
This commit is contained in:
Benjamin Lerer 2017-01-11 21:05:37 +01:00
parent 47f7d9c6aa
commit 70e8b39b02
3 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
2.1.17
* Fix paging for DISTINCT queries on partition keys and static columns (CASSANDRA-13017)
* Fix race causing infinite loop if Thrift server is stopped before it starts listening (CASSANDRA-12856)
* cqlsh copy-from: sort user type fields in csv (CASSANDRA-12959)
* Fix missed signal when commit log segments are recycled (CASSANDRA-13037)

View File

@ -74,7 +74,8 @@ public class RangeSliceQueryPager extends AbstractQueryPager
{
SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
Composite start = lastReturnedName == null ? sf.start() : lastReturnedName;
// For DISTINCT queries we can and must ignore the lastReturnedName (see CASSANDRA-13017)
Composite start = lastReturnedName == null || isDistinct() ? sf.start() : lastReturnedName;
PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
command.columnFamily,
command.timestamp,

View File

@ -146,7 +146,7 @@ public class QueryPagerTest extends SchemaLoader
private static RangeSliceCommand rangeSliceQuery(AbstractBounds<RowPosition> range, int count, String start, String end)
{
SliceQueryFilter filter = new SliceQueryFilter(CellNames.simpleDense(bytes(start)), CellNames.simpleDense(bytes(end)), false, Integer.MAX_VALUE);
return new RangeSliceCommand(KS, CF, System.currentTimeMillis(), filter, range, count);
return new RangeSliceCommand(KS, CF, System.currentTimeMillis(), filter, range, null, count, true, false);
}
private static void assertRow(Row r, String key, String... names)