Merge branch 'cassandra-2.0' into trunk
Conflicts:
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fd888bcb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fd888bcb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fd888bcb
Branch: refs/heads/trunk
Commit: fd888bcbcce2fda02c636e9b6d45cae9097180ca
Parents: 0a89f38 71a5127
Author: Sylvain Lebresne <[email protected]>
Authored: Mon Jan 13 10:36:29 2014 +0100
Committer: Sylvain Lebresne <[email protected]>
Committed: Mon Jan 13 10:36:29 2014 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/statements/SelectStatement.java | 21 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd888bcb/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd888bcb/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 4d89988,c3671be..5d5c12f
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@@ -799,39 -784,51 +799,40 @@@ public class SelectStatement implement
return expressions;
}
-
- private Iterable<Column> columnsInOrder(final ColumnFamily cf, final
List<ByteBuffer> variables) throws InvalidRequestException
+ private static ByteBuffer validateIndexedValue(ColumnDefinition def,
ByteBuffer value) throws InvalidRequestException
{
- if (columnRestrictions.length == 0)
- return cf.getSortedColumns();
-
- // If the restriction for the last column alias is an IN, respect
- // requested order
- Restriction last = columnRestrictions[columnRestrictions.length - 1];
- if (last == null || last.isSlice())
- return cf.getSortedColumns();
-
- ColumnNameBuilder builder = cfDef.getColumnNameBuilder();
- for (int i = 0; i < columnRestrictions.length - 1; i++)
- builder.add(columnRestrictions[i].values(variables).get(0));
+ if (value == null)
+ throw new InvalidRequestException(String.format("Unsupported null
value for indexed column %s", def.name));
+ if (value.remaining() > 0xFFFF)
+ throw new InvalidRequestException("Index expression values may
not be larger than 64K");
+ return value;
+ }
+ private Iterator<Cell> applySliceRestriction(final Iterator<Cell> cells,
final List<ByteBuffer> variables) throws InvalidRequestException
+ {
+ assert sliceRestriction != null;
- List<ByteBuffer> values = last.values(variables);
- final List<ByteBuffer> requested = new
ArrayList<ByteBuffer>(values.size());
- Iterator<ByteBuffer> iter = values.iterator();
- while (iter.hasNext())
- {
- ByteBuffer t = iter.next();
- ColumnNameBuilder b = iter.hasNext() ? builder.copy() : builder;
- requested.add(b.add(t).build());
- }
+ final CellNameType type = cfm.comparator;
+ final CellName excludedStart =
sliceRestriction.isInclusive(Bound.START) ? null :
type.makeCellName(sliceRestriction.bound(Bound.START, variables));
+ final CellName excludedEnd = sliceRestriction.isInclusive(Bound.END)
? null : type.makeCellName(sliceRestriction.bound(Bound.END, variables));
- return new Iterable<Column>()
+ return new AbstractIterator<Cell>()
{
- public Iterator<Column> iterator()
+ protected Cell computeNext()
{
- if (!cells.hasNext())
- return endOfData();
-
- Cell c = cells.next();
- return new AbstractIterator<Column>()
++ while (cells.hasNext())
+ {
- Iterator<ByteBuffer> iter = requested.iterator();
- public Column computeNext()
- {
- while (iter.hasNext())
- {
- Column column = cf.getColumn(iter.next());
- if (column != null)
- return column;
- }
- return endOfData();
- }
- };
++ Cell c = cells.next();
+
- // For dynamic CF, the column could be out of the requested
bounds (because we don't support strict bounds internally (unless
- // the comparator is composite that is)), filter here
- if ( (excludedStart != null && type.compare(c.name(),
excludedStart) == 0)
- || (excludedEnd != null && type.compare(c.name(),
excludedEnd) == 0) )
- return computeNext();
++ // For dynamic CF, the column could be out of the
requested bounds (because we don't support strict bounds internally (unless
++ // the comparator is composite that is)), filter here
++ if ( (excludedStart != null && type.compare(c.name(),
excludedStart) == 0)
++ || (excludedEnd != null && type.compare(c.name(),
excludedEnd) == 0) )
++ continue;
+
- return c;
++ return c;
++ }
++ return endOfData();
}
};
}