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 16:48:25 GMT
Seaching through the source for SortedKeyIterator shows that it is
used in 15 files. The FindMax class seems to be a fine example of its
use:

    IteratorSetting cfg = new IteratorSetting(Integer.MAX_VALUE,
SortedKeyIterator.class);
    scanner.addScanIterator(cfg);

That seems simple enough but when I change my code according I get a message:

  Exception in thread "main" java.lang.IllegalArgumentException:
Iterator name is already in use SKI98
	at org.apache.accumulo.core.client.impl.ScannerOptions.addScanIterator(ScannerOptions.java:67)
	at com.codebits.accumulo.RowIdIterator.<init>(RowIdIterator.java:22)

My code change was trivial:

	Iterator<Entry<Key, Value>> iterator = null;

	public RowIdIterator(Scanner scanner) {
		super();
		this.scanner = scanner;
	    IteratorSetting cfg = new IteratorSetting(Integer.MAX_VALUE,
"SKI98", SortedKeyIterator.class);
22 -->	    scanner.addScanIterator(cfg);
		this.iterator = scanner.iterator();
	}

	@Override
	public String next() {
		Entry<Key, Value> entry = iterator.next();
		return entry.getKey().getRow().toString();
	}

As you can see its name is unlikely to be in use.

Mime
View raw message