org.apache.accumulo.core.iterators.user
Class SummingArrayCombiner
java.lang.Object
org.apache.accumulo.core.iterators.WrappingIterator
org.apache.accumulo.core.iterators.Combiner
org.apache.accumulo.core.iterators.TypedValueCombiner<List<Long>>
org.apache.accumulo.core.iterators.user.SummingArrayCombiner
- All Implemented Interfaces:
- OptionDescriber, SortedKeyValueIterator<Key,Value>
public class SummingArrayCombiner
- extends TypedValueCombiner<List<Long>>
A Combiner that interprets Values as arrays of Longs and returns an array of element-wise sums.
Method Summary |
static List<Long> |
arrayAdd(List<Long> la,
List<Long> lb)
|
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. |
static void |
setEncodingType(IteratorSetting is,
Class<? extends TypedValueCombiner.Encoder<List<Long>>> encoderClass)
A convenience method for setting the encoding type. |
static void |
setEncodingType(IteratorSetting is,
String encoderClassName)
A convenience method for setting the encoding type. |
static void |
setEncodingType(IteratorSetting is,
SummingArrayCombiner.Type type)
A convenience method for setting the encoding type. |
List<Long> |
typedReduce(Key key,
Iterator<List<Long>> 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FIXED_LONG_ARRAY_ENCODER
public static final TypedValueCombiner.Encoder<List<Long>> FIXED_LONG_ARRAY_ENCODER
VAR_LONG_ARRAY_ENCODER
public static final TypedValueCombiner.Encoder<List<Long>> VAR_LONG_ARRAY_ENCODER
STRING_ARRAY_ENCODER
public static final TypedValueCombiner.Encoder<List<Long>> STRING_ARRAY_ENCODER
SummingArrayCombiner
public SummingArrayCombiner()
typedReduce
public List<Long> typedReduce(Key key,
Iterator<List<Long>> iter)
- Description copied from class:
TypedValueCombiner
- Reduces a list of V into a single V.
- Specified by:
typedReduce
in class TypedValueCombiner<List<Long>>
- Parameters:
key
- The most recent version of the Key being reduced.iter
- An iterator over the V for different versions of the key.
- Returns:
- The combined V.
arrayAdd
public static List<Long> arrayAdd(List<Long> la,
List<Long> lb)
init
public void init(SortedKeyValueIterator<Key,Value> source,
Map<String,String> options,
IteratorEnvironment env)
throws IOException
- Description copied from interface:
SortedKeyValueIterator
- Initializes the iterator. Data should not be read from the source in this method.
- Specified by:
init
in interface SortedKeyValueIterator<Key,Value>
- Overrides:
init
in class TypedValueCombiner<List<Long>>
- Parameters:
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.
- Throws:
IOException
- unused.
describeOptions
public OptionDescriber.IteratorOptions describeOptions()
- Description copied from interface:
OptionDescriber
- Gets an iterator options object that contains information needed to configure this iterator. This object will be used by the accumulo shell to prompt the
user to input the appropriate information.
- Specified by:
describeOptions
in interface OptionDescriber
- Overrides:
describeOptions
in class TypedValueCombiner<List<Long>>
- Returns:
- an iterator options object
validateOptions
public boolean validateOptions(Map<String,String> options)
- Description copied from interface:
OptionDescriber
- Check to see if an options map contains all options required by an iterator and that the option values are in the expected formats.
- Specified by:
validateOptions
in interface OptionDescriber
- Overrides:
validateOptions
in class TypedValueCombiner<List<Long>>
- Parameters:
options
- a map of option names to option values
- Returns:
- true if options are valid, false otherwise
setEncodingType
public static void setEncodingType(IteratorSetting is,
SummingArrayCombiner.Type type)
- A convenience method for setting the encoding type.
- Parameters:
is
- IteratorSetting object to configure.type
- SummingArrayCombiner.Type specifying the encoding type.
setEncodingType
public static void setEncodingType(IteratorSetting is,
Class<? extends TypedValueCombiner.Encoder<List<Long>>> encoderClass)
- A convenience method for setting the encoding type.
- Parameters:
is
- IteratorSetting object to configure.encoderClass
- Class extends Encoder>> specifying the encoding type.
setEncodingType
public static void setEncodingType(IteratorSetting is,
String encoderClassName)
- A convenience method for setting the encoding type.
- Parameters:
is
- IteratorSetting object to configure.encoderClassName
- name of a class specifying the encoding type.
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.