public abstract class LongCombiner extends TypedValueCombiner<Long>
public Long typedReduce(Key key, Iterator<Long> iter);
This typedReduce method will be passed the most recent Key and an iterator over the Values
(translated to Longs) for all non-deleted versions of that Key.
A required option for this Combiner is "type" which indicates which type of Encoder to use to
encode and decode Longs into Values. Supported types are VARNUM, LONG, and STRING which indicate
the VarNumEncoder, LongEncoder, and StringEncoder respectively.Modifier and Type | Class and Description |
---|---|
static class |
LongCombiner.FixedLenEncoder
An Encoder that uses an 8-byte encoding for Longs.
|
static class |
LongCombiner.StringEncoder
An Encoder that uses a String representation of Longs.
|
static class |
LongCombiner.Type |
static class |
LongCombiner.VarLenEncoder
An Encoder that uses a variable-length encoding for Longs.
|
TypedValueCombiner.Encoder<V>
Combiner.ValueIterator
OptionDescriber.IteratorOptions
Modifier and Type | Field and Description |
---|---|
protected static String |
CLASS_PREFIX |
static TypedValueCombiner.Encoder<Long> |
FIXED_LEN_ENCODER |
static TypedValueCombiner.Encoder<Long> |
STRING_ENCODER |
protected static String |
TYPE |
static TypedValueCombiner.Encoder<Long> |
VAR_LEN_ENCODER |
LOSSY
ALL_OPTION, COLUMNS_OPTION, REDUCE_ON_FULL_COMPACTION_ONLY_OPTION
Constructor and Description |
---|
LongCombiner() |
Modifier and Type | Method and Description |
---|---|
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 long |
safeAdd(long a,
long b) |
static void |
setEncodingType(IteratorSetting is,
Class<? extends TypedValueCombiner.Encoder<Long>> encoderClass)
A convenience method for setting the long encoding type.
|
static void |
setEncodingType(IteratorSetting is,
LongCombiner.Type type)
A convenience method for setting the long encoding type.
|
static void |
setEncodingType(IteratorSetting is,
String encoderClassName)
A convenience method for setting the long encoding type.
|
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.
|
deepCopy, reduce, setEncoder, setEncoder, setLossyness, testEncoder, testEncoder, typedReduce
getTopKey, getTopValue, hasTop, next, seek, setColumns, setCombineAllColumns, setReduceOnFullCompactionOnly
getSource, setSource
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
enableYielding
public static final TypedValueCombiner.Encoder<Long> FIXED_LEN_ENCODER
public static final TypedValueCombiner.Encoder<Long> VAR_LEN_ENCODER
public static final TypedValueCombiner.Encoder<Long> STRING_ENCODER
protected static final String TYPE
protected static final String CLASS_PREFIX
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 TypedValueCombiner<Long>
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 TypedValueCombiner<Long>
public boolean validateOptions(Map<String,String> options)
OptionDescriber
validateOptions
in interface OptionDescriber
validateOptions
in class TypedValueCombiner<Long>
options
- a map of option names to option valuespublic static long safeAdd(long a, long b)
public static void setEncodingType(IteratorSetting is, LongCombiner.Type type)
is
- IteratorSetting object to configure.type
- LongCombiner.Type specifying the encoding type.public static void setEncodingType(IteratorSetting is, Class<? extends TypedValueCombiner.Encoder<Long>> encoderClass)
is
- IteratorSetting object to configure.encoderClass
- Class<? extends Encoder<Long>>
specifying the encoding type.public static void setEncodingType(IteratorSetting is, String encoderClassName)
is
- IteratorSetting object to configure.encoderClassName
- name of a class specifying the encoding type.Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.