What you are proposing should work and I started to implement that using multiple threads over the token ranges but decided instead to use to Astyanax's read all rows recipe as it does much of that already. It required some work to convert the composite CQL2 format returned from Astayanx into what is expected for CQL3 but did work. Here's an outline of what you would do:
new AllRowsReader.Builder<String,Composite>(tableSchema.getKeyspace(),ColumnFam ily.newColumnFamily("some_table",StringSerializer.get(),CompositeSerializer .get())) .forEachPage(new Function<Rows<String, Composite>, Boolean>() { @Override public Boolean apply(Rows<String, Composite> rows) { try { for (Row<String,Composite> row : rows) { // rowkey serializer matches the time of the first column in your primary key definition String rowKey = StringSerializer.get().fromByteBuffer(row.getRawKey()); for (Column<Composite> column : row.getColumns()) { // the first portion of the column name composite is the parts of your primary definition beyond the first item // you will need to "build" the tuples accordingly String column1 = StringSerializer.get().fromByteBuffer((ByteBuffer)column.getName().get(0)); Integer column2 = IntegerSerializer.get((ByteBuffer)column.getName().get(1)); // the "leaf" column name is the last portion of the composite column name as a string String columnName = StringSerializer.get().fromByteBuffer((ByteBuffer)column.getName().get(2)); Integer columnValue = IntegerSerializer.get().fromByteBuffer(column.getByteBufferValue()); } } } catch (Exception e) { e.printStackTrace(); } return true; } }) .withPageSize(100) .withConcurrencyLevel(5) .withRepeatLastToken(false) .withIncludeEmptyRows(false) .build() .call(); I hope that helps! On 5/10/13 12:11 PM, "Thorsten von Eicken" <t...@rightscale.com> wrote: >What is the proper way to scan a table in CQL3 when using the random >partitioner? Specifically, what is the proper way to *start* the scan? >E.g., is it something like: > >select rowkey from my_table limit N; >while some_row_is_returned do > select rowkey from my_table where token(rowkey) > >token(last_rowkey_returned) limit N; > >or is it: > >select rowkey from my_table where token(rowkey) >= 0 limit N; >while some_row_is_returned do > select rowkey from my_table where token(rowkey) > >token(last_rowkey_returned) limit N; > >Is there a docs page I overlooked that spells this out? >Thanks! >Thorsten >