Skip to content

AccumuloParameters Examples

bfemiano edited this page Sep 17, 2012 · 5 revisions

This page will familiarize you with the scan settings possible using AccumuloParameters

This class delegate the following parameters to an internal instance of CommonParameters which implements Parameters

  1. MAX_RESULTS = control the number of key/value pairs to scan over.
  2. TABLE_NAME = table to search.
  3. BATCH_SIZE = number of key/value pairs to return for each round trip.
  4. CF_AND_QUAL_LIST = list of column_family:qualifier pairs to search. Can operate with just column_family.
  5. START_KEY = lower bound of scanning range.
  6. END_KEY = upper bound of scanning range.

In addition to these parameters, AccumuloParameters offers a number of Accumulo-specific parameters.

  1. ZOOKEEPERS = comma-delimited list of zookeepers.
  2. INSTANCE_NAME = Accumulo instance for connection.
  3. USER = Current user to authenticate and scan.
  4. PASSWORD = password for current user.

AccumuloParameters uses the Builder pattern to enforce parameter immutability after creation.

The below code creates a Builder instance for the root user that scans the 'people' table between keys '0' and '3'. Only the 'info' column family is requested.

AccumuloParameters.Builder builder = new AccumuloParameters.Builder()
                .setUser("root")
                .setPassword("password")
                .setStartKey("0")
                .setEndKey("3")
                .setTable("people")
                .setColumns(new String[]{"info"});

If we decide to insert our own custom named object, we can do so.

builder.addNamedProperty("CUSTOM_PARAM", param);

Additionally, we can supply iterators to apply during scan time

builder.addIteratorSetting(myIteratorSetting);

Finally we're ready to build an instance of AccumuloParameters

AccumuloParameters params = builder.build();
Clone this wiki locally