Class WrappedRecordReader<K extends WritableComparable<?>,U extends Writable>
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<K,V>
org.apache.hadoop.mapreduce.lib.join.ComposableRecordReader<K,U>
org.apache.hadoop.mapreduce.lib.join.WrappedRecordReader<K,U>
- All Implemented Interfaces:
Closeable,AutoCloseable,Comparable<ComposableRecordReader<K,?>>
@Public
@Stable
public class WrappedRecordReader<K extends WritableComparable<?>,U extends Writable>
extends ComposableRecordReader<K,U>
Proxy class for a RecordReader participating in the join framework.
This class keeps track of the "head" key-value pair for the
provided RecordReader and keeps a store of values matching a key when
this source is participating in a join.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an iterator to the collector at the position occupied by this RecordReader over the values in this stream paired with the key provided (ie register a stream of values from this source matching K with a collector).voidclose()Forward close request to proxied RR.intcompareTo(ComposableRecordReader<K, ?> other) Implement Comparable contract (compare key at head of proxied RR with that of another).Request new key from proxied RR.booleanReturn true iff compareTo(other) retn true.Get current keyGet current valuefloatRequest progress from proxied RR.inthashCode()booleanhasNext()Return true if the RR- including the k,v pair stored in this object- is exhausted.intid()voidinitialize(InputSplit split, TaskAttemptContext context) Called once at initialization.key()Return the key at the head of this RR.voidClone the key at the head of this RR into the object supplied.booleanRead the next k,v pair into the head of this object; return true iff the RR and this are exhausted.voidSkip key-value pairs with keys less than or equal to the key provided.
-
Field Details
-
empty
protected boolean empty -
cmp
-
-
Constructor Details
-
WrappedRecordReader
protected WrappedRecordReader(int id)
-
-
Method Details
-
initialize
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException Description copied from class:RecordReaderCalled once at initialization.- Specified by:
initializein classRecordReader<K extends WritableComparable<?>,U extends Writable> - Parameters:
split- the split that defines the range of records to readcontext- the information about the task- Throws:
IOExceptionInterruptedException
-
createKey
Request new key from proxied RR. -
createValue
-
id
public int id() -
key
Return the key at the head of this RR. -
key
Clone the key at the head of this RR into the object supplied.- Throws:
IOException
-
hasNext
public boolean hasNext()Return true if the RR- including the k,v pair stored in this object- is exhausted. -
skip
Skip key-value pairs with keys less than or equal to the key provided.- Throws:
IOExceptionInterruptedException
-
accept
public void accept(org.apache.hadoop.mapreduce.lib.join.CompositeRecordReader.JoinCollector i, K key) throws IOException, InterruptedException Add an iterator to the collector at the position occupied by this RecordReader over the values in this stream paired with the key provided (ie register a stream of values from this source matching K with a collector).- Throws:
IOExceptionInterruptedException
-
nextKeyValue
Read the next k,v pair into the head of this object; return true iff the RR and this are exhausted.- Specified by:
nextKeyValuein classRecordReader<K extends WritableComparable<?>,U extends Writable> - Returns:
- true if a key/value pair was read
- Throws:
IOExceptionInterruptedException
-
getCurrentKey
Get current key- Specified by:
getCurrentKeyin classRecordReader<K extends WritableComparable<?>,U extends Writable> - Returns:
- the current key or null if there is no current key
- Throws:
IOExceptionInterruptedException
-
getCurrentValue
Get current value- Specified by:
getCurrentValuein classRecordReader<K extends WritableComparable<?>,U extends Writable> - Returns:
- the object that was read
- Throws:
IOExceptionInterruptedException
-
getProgress
Request progress from proxied RR.- Specified by:
getProgressin classRecordReader<K extends WritableComparable<?>,U extends Writable> - Returns:
- a number between 0.0 and 1.0 that is the fraction of the data read
- Throws:
IOExceptionInterruptedException
-
close
Forward close request to proxied RR.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classRecordReader<K extends WritableComparable<?>,U extends Writable> - Throws:
IOException
-
compareTo
Implement Comparable contract (compare key at head of proxied RR with that of another). -
equals
Return true iff compareTo(other) retn true. -
hashCode
public int hashCode()
-