A SortedKeyValue implementation would allow you to skip across rows server side, potentially saving you lots of reads and network traffic.
On Sun, May 20, 2012 at 12:03 AM, David Medinets <[email protected]> wrote: >> We can also talk about how to make this more efficient with an iterator if >> you like. > > I would. How can it be more efficient? > > On Sat, May 19, 2012 at 7:49 PM, Adam Fuchs <[email protected]> wrote: >> One issue here is you are mixing Iterator and Iterable in the same object. > > Good point. I've fixed that. And also looked at MockInstance. I've > changed my code to the following which does seem to work. I have some > code handle Column Family iterating but I want to hear about > efficiency before I post that code. > > public class IteratorTestDriver { > > public static void main(String[] args) throws IOException, > AccumuloException, AccumuloSecurityException, TableExistsException, > TableNotFoundException { > Instance mock = new MockInstance("development"); > Connector connector = mock.getConnector("root", > "password".getBytes()); > connector.tableOperations().create("TABLEA"); > > BatchWriter wr = connector.createBatchWriter("TABLEA", > 10000000, 10000, 5); > for(int i = 0; i < 1000; ++i) { > Mutation m = new Mutation("row_"+i); > m.put("cf_"+i, "cq_"+1, "val_"+1); > wr.addMutation(m); > } > wr.close(); > > Scanner scanner = connector.createScanner("TABLEA", new > Authorizations()); > > for (String rowId : new RowIdIterator(scanner)) { > System.out.println("ROW ID: " + rowId); > } > > } > }
