accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victoria Bare <>
Subject Filter Implementation - Accumulo 1.3
Date Tue, 23 Oct 2012 13:54:00 GMT

I am currently using Accumulo 1.3 to implement a Filter.  Since I'm using
1.3, I realize that the Filter class is not an iterator so I have created a
MyFilter class that implements Filter to use when I initialize my Scanner.
 When I run my code, I am getting an  AccumuloServerException.

I was referencing the posts from December 2011 on "Filter Use" to
initialize my scanner with MyFilter.
My scanner initialization currently appears as so:

Instance zooInstance = new ZooKeeperInstance(*instanceName*, *zooServers*);
Connector connector = zooInstance.getConnector(*userName*, *password*);
Authorizations authorizations = new Authorizations();
Scanner scanner = connector.createScanner(*tableName*, authorizations);


"org.apache.accumulo.core.iterators.FilteringIterator", "myFilter");
scanner.setScanIteratorOption("myFilter", "0", "test.offsets.MyFilter");
scanner.setScanIteratorOption("myFilter", "0.start", *start*);

Iterator<Entry<Key,Value>> iterator = scanner.iterator();

while(iterator.hasNext()) {          <--- Exception here




public class MyFilter implements Filter{
 long startOfRange = 0;
public boolean accept(Key key, Value value) {
 String colqual = key.getColumnQualifier().toString();
long end = Long.parseLong(colqual.substring(20, 39));
 if(end < startOfRange){
return false;
 return true;

public void init(Map<String, String> options) {

if(options == null){
throw new IllegalArgumentException("'start' must be set for filter");
 String start = options.get("start");
if(start == null){
throw new IllegalArgumentException("'start' must be set for filter");
 startOfRange = Long.parseLong(start);



The Exception that I'm receiving is:

Exception in thread "main" java.lang.RuntimeException:
at test.offsets.TestFilter.getFilterEntrySetRange(
at test.offsets.TestFilter.main(


I was thinking that maybe the server couldn't find the MyFilter class, or
maybe it was a permissions error, but I wasn't sure.  When I initialize my
Scanner to use MyFilter, is it looking on the server for the file or in my

Any assistance you can provide would be greatly appreciated, thanks!

View raw message