org.apache.accumulo.core.iterators
public abstract class TypedValueCombiner<V> extends Combiner
Modifier and Type | Class and Description |
---|---|
static interface |
TypedValueCombiner.Encoder<V>
An interface for translating from byte[] to V and back.
|
Combiner.ValueIterator
OptionDescriber.IteratorOptions
Modifier and Type | Field and Description |
---|---|
protected static String |
LOSSY |
ALL_OPTION, COLUMNS_OPTION
Constructor and Description |
---|
TypedValueCombiner() |
Modifier and Type | Method and Description |
---|---|
SortedKeyValueIterator<Key,Value> |
deepCopy(IteratorEnvironment env)
Creates a deep copy of this iterator as though seek had not yet been called.
|
OptionDescriber.IteratorOptions |
describeOptions()
Gets an iterator options object that contains information needed to configure this iterator.
|
void |
init(SortedKeyValueIterator<Key,Value> source,
Map<String,String> options,
IteratorEnvironment env)
Initializes the iterator.
|
Value |
reduce(Key key,
Iterator<Value> iter)
Reduces a list of Values into a single Value.
|
protected void |
setEncoder(String encoderClass)
Instantiates and sets the Encoder
|
protected void |
setEncoder(TypedValueCombiner.Encoder<V> encoder)
Sets the Encoder
|
static void |
setLossyness(IteratorSetting is,
boolean lossy)
A convenience method to set the "lossy" option on a TypedValueCombiner.
|
static <V> void |
testEncoder(TypedValueCombiner.Encoder<V> encoder,
V v)
Tests whether v remains the same when encoded and decoded with the given encoder.
|
protected void |
testEncoder(V v)
Tests whether v remains the same when encoded and decoded with the current encoder.
|
abstract V |
typedReduce(Key key,
Iterator<V> iter)
Reduces a list of V into a single V.
|
boolean |
validateOptions(Map<String,String> options)
Check to see if an options map contains all options required by an iterator and that the option values are in the expected formats.
|
getTopKey, getTopValue, hasTop, next, seek, setColumns, setCombineAllColumns
getSource, setSource
protected static final String LOSSY
protected void setEncoder(TypedValueCombiner.Encoder<V> encoder)
protected void setEncoder(String encoderClass)
IllegalArgumentException
- if ClassNotFoundException, InstantiationException, or IllegalAccessException occursprotected void testEncoder(V v)
IllegalStateException
- if an encoder has not been set.IllegalArgumentException
- if the test fails.public static <V> void testEncoder(TypedValueCombiner.Encoder<V> encoder, V v)
IllegalArgumentException
- if the test fails.public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env)
SortedKeyValueIterator
public Value reduce(Key key, Iterator<Value> iter)
Combiner
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException
SortedKeyValueIterator
init
in interface SortedKeyValueIterator<Key,Value>
init
in class Combiner
source
- SortedKeyValueIterator source to read data from.options
- Map map of string option names to option values.env
- IteratorEnvironment environment in which iterator is being run.IOException
- unused.public OptionDescriber.IteratorOptions describeOptions()
OptionDescriber
describeOptions
in interface OptionDescriber
describeOptions
in class Combiner
public boolean validateOptions(Map<String,String> options)
OptionDescriber
validateOptions
in interface OptionDescriber
validateOptions
in class Combiner
options
- a map of option names to option valuespublic static void setLossyness(IteratorSetting is, boolean lossy)
is
- iterator settings object to configurelossy
- if true the combiner will ignored values which fail to decode; otherwise error.Copyright © 2014 Apache Accumulo Project. All Rights Reserved.