accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Vines <>
Subject Common scanner base
Date Thu, 10 May 2012 13:17:58 GMT
This came up at the meetup last night, figured I would throw this up here
just in case anyone else is interested.

The case was a user wanted a method for manipulating scan results, whether
they be standard scanner or batch scanner. Turns out, it is pretty easy to
have a common base, at least as of Accumulo 1.4.1.

public class Scratch {
  public static void main(String[] args) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
    Instance instance = new ZooKeeperInstance("test", "localhost:2181");
    Connector conn = instance.getConnector("root", "secret".getBytes());

    Scanner scan = conn.createScanner("test", new Authorizations());


    BatchScanner bs = conn.createBatchScanner("test", new Authorizations(),
    bs.setRanges(Arrays.asList(new Range()));


   * @param scan
  private static void dumpScan(Iterable<Entry<Key,Value>> scan) {
    for (Entry<Key,Value> e : scan)

Don't want it as generic (and ugly) as Iterable<Entry<Key,Value>>? You can
also use ScannerOptions or ScannerBase!

View raw message