Avoid wrapping results with ThriftResultsMerger if command is not for thrift

Patch by Alex Petrov; reviewed by Tyler Hobbs for CASSANDRA-12193.
This commit is contained in:
Alex Petrov 2016-07-15 17:49:16 -05:00 committed by Tyler Hobbs
parent 84426d183a
commit 557c59607f
1 changed files with 9 additions and 4 deletions

View File

@ -282,12 +282,17 @@ public abstract class ReadResponse
// Pre-3.0, we didn't have a way to express exclusivity for non-composite comparators, so all slices were
// inclusive on both ends. If we have exclusive slice ends, we need to filter the results here.
UnfilteredRowIterator iterator;
if (!command.metadata().isCompound())
return ThriftResultsMerger.maybeWrap(
filter.filter(partition.sliceableUnfilteredIterator(command.columnFilter(), filter.isReversed())), command.nowInSec());
iterator = filter.filter(partition.sliceableUnfilteredIterator(command.columnFilter(), filter.isReversed()));
else
iterator = partition.unfilteredIterator(command.columnFilter(), Slices.ALL, filter.isReversed());
return ThriftResultsMerger.maybeWrap(
partition.unfilteredIterator(command.columnFilter(), Slices.ALL, filter.isReversed()), command.nowInSec());
// Wrap results with a ThriftResultMerger only if they're intended for the thrift command.
if (command.isForThrift())
return ThriftResultsMerger.maybeWrap(iterator, command.nowInSec());
else
return iterator;
}
};
}