Repository: cassandra Updated Branches: refs/heads/trunk 106b43d44 -> 345772dd8
Fix bad merge of 6825 into cassandra-2.1 Patch by Tyler Hobbs; reviewed by Aleksey Yeschenko for CASSANDRA-6978 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3a51a7e8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3a51a7e8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3a51a7e8 Branch: refs/heads/trunk Commit: 3a51a7e83a7227ebaeacc6098a6ee7875f536c65 Parents: e6e596d Author: Tyler Hobbs <ty...@datastax.com> Authored: Thu Apr 3 16:12:54 2014 -0500 Committer: Tyler Hobbs <ty...@datastax.com> Committed: Thu Apr 3 16:12:54 2014 -0500 ---------------------------------------------------------------------- src/java/org/apache/cassandra/db/filter/ColumnSlice.java | 3 ++- .../unit/org/apache/cassandra/db/filter/ColumnSliceTest.java | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a51a7e8/src/java/org/apache/cassandra/db/filter/ColumnSlice.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/filter/ColumnSlice.java b/src/java/org/apache/cassandra/db/filter/ColumnSlice.java index 227297e..6e2fa68 100644 --- a/src/java/org/apache/cassandra/db/filter/ColumnSlice.java +++ b/src/java/org/apache/cassandra/db/filter/ColumnSlice.java @@ -88,7 +88,8 @@ public class ColumnSlice ByteBuffer f = i < sEnd.size() ? sEnd.get(i) : ByteBufferUtil.EMPTY_BYTE_BUFFER; // we already know the first component falls within its min/max range (otherwise we wouldn't get here) - if (i > 0 && (t.compare(f, minCellNames.get(i)) < 0 || t.compare(s, maxCellNames.get(i)) > 0)) + if (i > 0 && (i < sEnd.size() && t.compare(f, minCellNames.get(i)) < 0 || + i < sStart.size() && t.compare(s, maxCellNames.get(i)) > 0)) return false; // if this component isn't equal in the start and finish, we don't need to check any more http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a51a7e8/test/unit/org/apache/cassandra/db/filter/ColumnSliceTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/filter/ColumnSliceTest.java b/test/unit/org/apache/cassandra/db/filter/ColumnSliceTest.java index e2de0e6..6553de5 100644 --- a/test/unit/org/apache/cassandra/db/filter/ColumnSliceTest.java +++ b/test/unit/org/apache/cassandra/db/filter/ColumnSliceTest.java @@ -165,6 +165,10 @@ public class ColumnSliceTest slice = new ColumnSlice(composite(1), composite(1, 2)); assertTrue(slice.intersects(columnNames(1, 0, 0), columnNames(2, 2, 2), nameType, false)); + // same case, but with an equal first component and missing start and end components + slice = new ColumnSlice(composite(1), composite(1)); + assertTrue(slice.intersects(columnNames(1, 0, 0), columnNames(2, 2, 2), nameType, false)); + // slice falls entirely within sstable (slice start and end are the same) slice = new ColumnSlice(composite(1, 1, 1), composite(1, 1, 1)); assertTrue(slice.intersects(columnNames(1, 0, 0), columnNames(2, 2, 2), nameType, false)); @@ -281,7 +285,7 @@ public class ColumnSliceTest types.add(Int32Type.instance); types.add(Int32Type.instance); CompoundDenseCellNameType nameType = new CompoundDenseCellNameType(types); - return nameType.make(components); + return nameType.make((Object[]) components); } private static List<ByteBuffer> columnNames(Integer ... components) @@ -291,4 +295,4 @@ public class ColumnSliceTest names.add(ByteBufferUtil.bytes(component)); return names; } -} +} \ No newline at end of file