Package oracle.kv.hadoop.table
Class TableRecordReader
- java.lang.Object
 - 
- org.apache.hadoop.mapreduce.RecordReader<K,V>
 - 
- oracle.kv.hadoop.table.TableRecordReader
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable
public class TableRecordReader extends RecordReader<K,V>
Concrete implementation of TableRecordReaderBase that reads table rows from an InputSplit using a PrimaryKey.- Since:
 - 3.1
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected Rowcurrentprotected static java.lang.StringUSER_SECURITY_DIR 
- 
Constructor Summary
Constructors Constructor Description TableRecordReader() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the record reader.PrimaryKeygetCurrentKey()Get the current key.RowgetCurrentValue()Get the current value.TablegetKvTable()floatgetProgress()The current progress of the record reader through its data.voidinitialize(InputSplit split, TaskAttemptContext context)Called once at initialization.booleannextKeyValue()Reads the next key/value pair as aRowand then processes the contents of the row.voidsetIndexKey(IndexKey key)voidsetIterFailHook(oracle.kv.impl.test.TestHook<RecordValue> iterFailHook)Used only when testing.voidsetMultiRowOptions(FieldRange fieldRange)voidsetPrimaryKey(PrimaryKey key)voidsetQueryInfo(int newQueryBy, java.lang.String newWhereClause)voidsetStore(KVStore testStore)For testing only; to support the use of a mocked store. 
 - 
 
- 
- 
Field Detail
- 
USER_SECURITY_DIR
protected static final java.lang.String USER_SECURITY_DIR
 
- 
current
protected Row current
 
 - 
 
- 
Method Detail
- 
getCurrentKey
public PrimaryKey getCurrentKey() throws java.io.IOException, java.lang.InterruptedException
Get the current key.- Specified by:
 getCurrentKeyin classRecordReader<PrimaryKey,Row>- Returns:
 - the current key or null if there is no current key
 - Throws:
 java.io.IOException- if an I/O error occursjava.lang.InterruptedException- if the operation is interrupted
 
- 
getCurrentValue
public Row getCurrentValue() throws java.io.IOException, java.lang.InterruptedException
Get the current value.- Specified by:
 getCurrentValuein classRecordReader<PrimaryKey,Row>- Returns:
 - the object that was read
 - Throws:
 java.io.IOException- if an I/O error occursjava.lang.InterruptedException- if the operation is interrupted
 
- 
initialize
public void initialize(InputSplit split, TaskAttemptContext context) throws java.io.IOException, java.lang.InterruptedException
Called once at initialization.- Specified by:
 initializein classRecordReader<K,V>- Parameters:
 split- the split that defines the range of records to readcontext- the information about the task- Throws:
 java.io.IOException- if an I/O error occursjava.lang.InterruptedException- if the operation is interrupted
 
- 
nextKeyValue
public boolean nextKeyValue() throws java.io.IOExceptionReads the next key/value pair as aRowand then processes the contents of the row.- Specified by:
 nextKeyValuein classRecordReader<K,V>- Returns:
 truewhen a key/value pair was successfully read and processed; otherwise, returnsfalsewhen EOF is encountered.- Throws:
 java.io.IOException- whenIOExceptionoccurs during processing. When any other type of exception is encountered during processing, throws that exception wrapped inIOException; to be consistent with the HadoopRecordReaderinterface implemented by this class. See SR25870 for more details.
 
- 
getProgress
public float getProgress()
The current progress of the record reader through its data.- Specified by:
 getProgressin classRecordReader<K,V>- Returns:
 - a number between 0.0 and 1.0 that is the fraction of the data read
 
 
- 
close
public void close() throws java.io.IOExceptionClose the record reader.- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Specified by:
 closein classRecordReader<K,V>- Throws:
 java.io.IOException
 
- 
getKvTable
public Table getKvTable()
 
- 
setIndexKey
public void setIndexKey(IndexKey key)
 
- 
setPrimaryKey
public void setPrimaryKey(PrimaryKey key)
 
- 
setMultiRowOptions
public void setMultiRowOptions(FieldRange fieldRange)
 
- 
setStore
public void setStore(KVStore testStore)
For testing only; to support the use of a mocked store. 
- 
setQueryInfo
public void setQueryInfo(int newQueryBy, java.lang.String newWhereClause) 
- 
setIterFailHook
public void setIterFailHook(oracle.kv.impl.test.TestHook<RecordValue> iterFailHook)
Used only when testing. See SR25870. 
 - 
 
 -