mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.0' into cassandra-2.1
This commit is contained in:
commit
57fa76fda2
|
|
@ -27,13 +27,14 @@ import java.util.*;
|
|||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import org.apache.cassandra.hadoop.HadoopCompat;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
import org.apache.cassandra.db.marshal.CompositeType;
|
||||
import org.apache.cassandra.db.marshal.LongType;
|
||||
import org.apache.cassandra.db.marshal.ReversedType;
|
||||
import org.apache.cassandra.db.marshal.TypeParser;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
|
|
@ -507,7 +508,7 @@ public class CqlPagingRecordReader extends RecordReader<Map<String, ByteBuffer>,
|
|||
private Pair<Integer, String> whereClause(List<BoundColumn> column, int position)
|
||||
{
|
||||
if (position == column.size() - 1 || column.get(position + 1).value == null)
|
||||
return Pair.create(position + 2, String.format(" AND %s > ? ", quote(column.get(position).name)));
|
||||
return Pair.create(position + 2, String.format(" AND %s %s ? ", quote(column.get(position).name), column.get(position).reversed ? " < " : " >"));
|
||||
|
||||
Pair<Integer, String> clause = whereClause(column, position + 1);
|
||||
return Pair.create(clause.left, String.format(" AND %s = ? %s", quote(column.get(position).name), clause.right));
|
||||
|
|
@ -711,6 +712,20 @@ public class CqlPagingRecordReader extends RecordReader<Map<String, ByteBuffer>,
|
|||
{
|
||||
partitionBoundColumns.get(0).validator = keyValidator;
|
||||
}
|
||||
|
||||
Column rawComparator = cqlRow.columns.get(3);
|
||||
String comparator = ByteBufferUtil.string(ByteBuffer.wrap(rawComparator.getValue()));
|
||||
logger.debug("comparator: {}", comparator);
|
||||
AbstractType comparatorValidator = parseType(comparator);
|
||||
if (comparatorValidator instanceof CompositeType)
|
||||
{
|
||||
for (int i = 0; i < clusterColumns.size(); i++)
|
||||
clusterColumns.get(i).reversed = (((CompositeType) comparatorValidator).types.get(i) instanceof ReversedType);
|
||||
}
|
||||
else if (comparatorValidator instanceof ReversedType)
|
||||
{
|
||||
clusterColumns.get(0).reversed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** check whether current row is at the end of range */
|
||||
|
|
@ -762,6 +777,7 @@ public class CqlPagingRecordReader extends RecordReader<Map<String, ByteBuffer>,
|
|||
final String name;
|
||||
ByteBuffer value;
|
||||
AbstractType<?> validator;
|
||||
boolean reversed = false;
|
||||
|
||||
public BoundColumn(String name)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue