ByteBuffer finishKey = (select.getKeyFinish() != null)
? select.getKeyFinish().getByteBuffer(keyType)
: (new Term()).getByteBuffer();
Token startToken = p.getToken(startKey), finishToken = p.getToken(finishKey);
if (startToken.compareTo(finishToken) > 0 && !finishToken.equals(p.getMinimumToken()))
{
if (p instanceof RandomPartitioner)
throw new InvalidRequestException("Start key's md5 sorts after end key's md5. This is not allowed; you probably should not specify end key at all, under RandomPartitioner");
else
throw new InvalidRequestException("Start key must sort before (or equal to) finish key in your partitioner!");