accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Medinets <david.medin...@gmail.com>
Subject Re: ROW ID Iterator - sanity check
Date Sun, 20 May 2012 04:03:58 GMT
> 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 <adam.p.fuchs@ugov.gov> 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);
        }
		
	}
}

Mime
View raw message