public static List<Row> getRangeSlice(ColumnFamilyStore cfs, ByteBuffer superColumn) throws IOException, ExecutionException, InterruptedException { Token min = StorageService.getPartitioner().getMinimumToken(); return cfs.getRangeSlice( superColumn, new Bounds<Token>(min, min).toRowBounds(), 10000, new IdentityQueryFilter(), null); }
public static List<Row> getRangeSlice(ColumnFamilyStore cfs, ByteBuffer superColumn) { IDiskAtomFilter filter = superColumn == null ? new IdentityQueryFilter() : new SliceQueryFilter( SuperColumns.startOf(superColumn), SuperColumns.endOf(superColumn), false, Integer.MAX_VALUE); Token min = StorageService.getPartitioner().getMinimumToken(); return cfs.getRangeSlice(Bounds.makeRowBounds(min, min), null, filter, 10000); }
@Test public void testGetSliceWithCollision() throws Exception { Keyspace keyspace = Keyspace.open(KEYSPACE); ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF); cfs.clearUnsafe(); insert("k1", "k2", "k3"); // token = 2 insert("key1", "key2", "key3"); // token = 4 insert("longKey1", "longKey2"); // token = 8 List<Row> rows = cfs.getRangeSlice( new Bounds<RowPosition>(dk("k2"), dk("key2")), null, new IdentityQueryFilter(), 10000); assert rows.size() == 4 : "Expecting 4 keys, got " + rows.size(); assert rows.get(0).key.key.equals(ByteBufferUtil.bytes("k2")); assert rows.get(1).key.key.equals(ByteBufferUtil.bytes("k3")); assert rows.get(2).key.key.equals(ByteBufferUtil.bytes("key1")); assert rows.get(3).key.key.equals(ByteBufferUtil.bytes("key2")); }