org.apache.accumulo.examples.simple.combiner
Class StatsCombiner

java.lang.Object
  extended by org.apache.accumulo.core.iterators.WrappingIterator
      extended by org.apache.accumulo.core.iterators.Combiner
          extended by org.apache.accumulo.examples.simple.combiner.StatsCombiner
All Implemented Interfaces:
OptionDescriber, SortedKeyValueIterator<Key,Value>

public class StatsCombiner
extends Combiner

This combiner calculates the max, min, sum, and count of long integers represented as strings in values. It stores the result in a comma-separated value of the form max,min,sum,count. If such a value is encountered while combining, its information is incorporated into the running calculations of max, min, sum, and count. See Combiner for more information on which values are combined together. See docs/examples/README.combiner for instructions.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.accumulo.core.iterators.Combiner
Combiner.ValueIterator
 
Nested classes/interfaces inherited from interface org.apache.accumulo.core.iterators.OptionDescriber
OptionDescriber.IteratorOptions
 
Field Summary
static String RADIX_OPTION
           
 
Fields inherited from class org.apache.accumulo.core.iterators.Combiner
ALL_OPTION, COLUMNS_OPTION
 
Constructor Summary
StatsCombiner()
           
 
Method Summary
 OptionDescriber.IteratorOptions describeOptions()
           
 void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env)
           
 Value reduce(Key key, Iterator<Value> iter)
           
static void setRadix(IteratorSetting iterConfig, int base)
          A convenience method for setting the expected base/radix of the numbers
 boolean validateOptions(Map<String,String> options)
           
 
Methods inherited from class org.apache.accumulo.core.iterators.Combiner
deepCopy, getTopKey, getTopValue, hasTop, next, seek, setColumns, setCombineAllColumns
 
Methods inherited from class org.apache.accumulo.core.iterators.WrappingIterator
getSource, setSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIX_OPTION

public static final String RADIX_OPTION
See Also:
Constant Field Values
Constructor Detail

StatsCombiner

public StatsCombiner()
Method Detail

reduce

public Value reduce(Key key,
                    Iterator<Value> iter)
Specified by:
reduce in class Combiner

init

public void init(SortedKeyValueIterator<Key,Value> source,
                 Map<String,String> options,
                 IteratorEnvironment env)
          throws IOException
Specified by:
init in interface SortedKeyValueIterator<Key,Value>
Overrides:
init in class Combiner
Throws:
IOException

describeOptions

public OptionDescriber.IteratorOptions describeOptions()
Specified by:
describeOptions in interface OptionDescriber
Overrides:
describeOptions in class Combiner

validateOptions

public boolean validateOptions(Map<String,String> options)
Specified by:
validateOptions in interface OptionDescriber
Overrides:
validateOptions in class Combiner

setRadix

public static void setRadix(IteratorSetting iterConfig,
                            int base)
A convenience method for setting the expected base/radix of the numbers

Parameters:
iterConfig - Iterator settings to configure
base - The expected base/radix of the numbers.


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.