Class AbstractInputFormat.AbstractRecordReader<K,V>
- java.lang.Object
-
- org.apache.hadoop.mapreduce.RecordReader<K,V>
-
- org.apache.accumulo.core.client.mapreduce.AbstractInputFormat.AbstractRecordReader<K,V>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
InputFormatBase.RecordReaderBase
- Enclosing class:
- AbstractInputFormat<K,V>
protected abstract static class AbstractInputFormat.AbstractRecordReader<K,V> extends org.apache.hadoop.mapreduce.RecordReader<K,V>
An abstract base class to be used to createRecordReader
instances that convert from AccumuloKey
/Value
pairs to the user's K/V types. Subclasses must implementRecordReader.nextKeyValue()
and use it to update the following variables:- K
currentK
- V
currentV
- Key
currentKey
(used for progress reporting) - int
numKeysRead
(used for progress reporting)
-
-
Field Summary
Fields Modifier and Type Field Description protected K
currentK
The Key that should be returned to the clientprotected Key
currentKey
The Key that is used to determine progress in the current InputSplit.protected V
currentV
The Value that should be return to the clientprotected long
numKeysRead
protected ScannerBase
scannerBase
protected Iterator<Map.Entry<Key,Value>>
scannerIterator
protected RangeInputSplit
split
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRecordReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
protected abstract List<IteratorSetting>
contextIterators(org.apache.hadoop.mapreduce.TaskAttemptContext context, String tableName)
Extracts Iterators settings from the context to be used by RecordReader.K
getCurrentKey()
V
getCurrentValue()
float
getProgress()
void
initialize(org.apache.hadoop.mapreduce.InputSplit inSplit, org.apache.hadoop.mapreduce.TaskAttemptContext attempt)
protected void
setupIterators(org.apache.hadoop.mapreduce.TaskAttemptContext context, Scanner scanner, String tableName, RangeInputSplit split)
Deprecated.since 1.7.0; UsecontextIterators(org.apache.hadoop.mapreduce.TaskAttemptContext, java.lang.String)
instead.
-
-
-
Field Detail
-
numKeysRead
protected long numKeysRead
-
scannerBase
protected ScannerBase scannerBase
-
split
protected RangeInputSplit split
-
currentK
protected K currentK
The Key that should be returned to the client
-
currentV
protected V currentV
The Value that should be return to the client
-
currentKey
protected Key currentKey
The Key that is used to determine progress in the current InputSplit. It is not returned to the client and is only used internally
-
-
Method Detail
-
contextIterators
protected abstract List<IteratorSetting> contextIterators(org.apache.hadoop.mapreduce.TaskAttemptContext context, String tableName)
Extracts Iterators settings from the context to be used by RecordReader.- Parameters:
context
- the Hadoop context for the configured jobtableName
- the table name for which the scanner is configured- Returns:
- List of iterator settings for given table
- Since:
- 1.7.0
-
setupIterators
@Deprecated protected void setupIterators(org.apache.hadoop.mapreduce.TaskAttemptContext context, Scanner scanner, String tableName, RangeInputSplit split)
Deprecated.since 1.7.0; UsecontextIterators(org.apache.hadoop.mapreduce.TaskAttemptContext, java.lang.String)
instead.Configures the iterators on a scanner for the given table name.- Parameters:
context
- the Hadoop context for the configured jobscanner
- the scanner for which to configure the iteratorstableName
- the table name for which the scanner is configured- Since:
- 1.6.0
-
initialize
public void initialize(org.apache.hadoop.mapreduce.InputSplit inSplit, org.apache.hadoop.mapreduce.TaskAttemptContext attempt) throws IOException
- Specified by:
initialize
in classorg.apache.hadoop.mapreduce.RecordReader<K,V>
- Throws:
IOException
-
close
public void close()
-
getProgress
public float getProgress() throws IOException
- Specified by:
getProgress
in classorg.apache.hadoop.mapreduce.RecordReader<K,V>
- Throws:
IOException
-
getCurrentKey
public K getCurrentKey() throws IOException, InterruptedException
- Specified by:
getCurrentKey
in classorg.apache.hadoop.mapreduce.RecordReader<K,V>
- Throws:
IOException
InterruptedException
-
getCurrentValue
public V getCurrentValue() throws IOException, InterruptedException
- Specified by:
getCurrentValue
in classorg.apache.hadoop.mapreduce.RecordReader<K,V>
- Throws:
IOException
InterruptedException
-
-