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:
Closeable
,AutoCloseable
Concrete implementation of TableRecordReaderBase that reads table rows
from an InputSplit using a PrimaryKey.
- Since:
- 3.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the record reader.Get the current key.Get the current value.float
The current progress of the record reader through its data.void
initialize
(InputSplit split, TaskAttemptContext context) Called once at initialization.boolean
Reads the next key/value pair as aRow
and then processes the contents of the row.void
setIndexKey
(IndexKey key) void
setIterFailHook
(oracle.kv.impl.test.TestHook<RecordValue> iterFailHook) Used only when testing.void
setMultiRowOptions
(FieldRange fieldRange) void
setPrimaryKey
(PrimaryKey key) void
setQueryInfo
(int newQueryBy, String newWhereClause) void
For testing only; to support the use of a mocked store.
-
Field Details
-
USER_SECURITY_DIR
-
current
-
-
Constructor Details
-
TableRecordReader
public TableRecordReader()
-
-
Method Details
-
getCurrentKey
Get the current key.- Specified by:
getCurrentKey
in classRecordReader<PrimaryKey,
Row> - Returns:
- the current key or null if there is no current key
- Throws:
IOException
- if an I/O error occursInterruptedException
- if the operation is interrupted
-
getCurrentValue
Get the current value.- Specified by:
getCurrentValue
in classRecordReader<PrimaryKey,
Row> - Returns:
- the object that was read
- Throws:
IOException
- if an I/O error occursInterruptedException
- if the operation is interrupted
-
initialize
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException Called once at initialization.- Specified by:
initialize
in classRecordReader<K,
V> - Parameters:
split
- the split that defines the range of records to readcontext
- the information about the task- Throws:
IOException
- if an I/O error occursInterruptedException
- if the operation is interrupted
-
nextKeyValue
Reads the next key/value pair as aRow
and then processes the contents of the row.- Specified by:
nextKeyValue
in classRecordReader<K,
V> - Returns:
true
when a key/value pair was successfully read and processed; otherwise, returnsfalse
when EOF is encountered.- Throws:
IOException
- whenIOException
occurs during processing. When any other type of exception is encountered during processing, throws that exception wrapped inIOException
; to be consistent with the HadoopRecordReader
interface 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:
getProgress
in classRecordReader<K,
V> - Returns:
- a number between 0.0 and 1.0 that is the fraction of the data read
-
close
Close the record reader.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classRecordReader<K,
V> - Throws:
IOException
-
getKvTable
-
setIndexKey
-
setPrimaryKey
-
setMultiRowOptions
-
setStore
For testing only; to support the use of a mocked store. -
setQueryInfo
-
setIterFailHook
Used only when testing. See SR25870.
-