-
Notifications
You must be signed in to change notification settings - Fork 2
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
- MAX_RESULTS = control the number of key/value pairs to scan over.
- TABLE_NAME = table to search.
- BATCH_SIZE = number of key/value pairs to return for each round trip.
- CF_AND_QUAL_LIST = list of column_family:qualifier pairs to search. Can operate with just column_family.
- START_KEY = lower bound of scanning range.
- END_KEY = upper bound of scanning range.
In addition to these parameters, AccumuloParameters offers a number of Accumulo-specific parameters.
- ZOOKEEPERS = comma-delimited list of zookeepers.
- INSTANCE_NAME = Accumulo instance for connection.
- USER = Current user to authenticate and scan.
- 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();