Package org.apache.hadoop.mapred.join
Class WrappedRecordReader<K extends WritableComparable,U extends Writable>
java.lang.Object
org.apache.hadoop.mapred.join.WrappedRecordReader<K,U>
- All Implemented Interfaces:
Closeable,AutoCloseable,Comparable<ComposableRecordReader<K,,?>> Configurable,ComposableRecordReader<K,,U> RecordReader<K,U>
@Public
@Stable
public class WrappedRecordReader<K extends WritableComparable,U extends Writable>
extends Object
implements ComposableRecordReader<K,U>, Configurable
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.
-
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.Request new value from proxied RR.booleanReturn true iff compareTo(other) retn true.getConf()Return the configuration used by this object.longgetPos()Request position from proxied RR.floatRequest progress from proxied RR.inthashCode()booleanhasNext()Return true if the RR- including the k,v pair stored in this object- is exhausted.intid()Return the position in the collector this class occupies.key()Return the key at the head of this RR.voidClone the key at the head of this RR into the object supplied.protected booleannext()Read the next k,v pair into the head of this object; return true iff the RR and this are exhausted.booleanWrite key-value pair at the head of this stream to the objects provided; get next key-value pair from proxied RR.voidsetConf(Configuration conf) Set the configuration to be used by this object.voidSkip key-value pairs with keys less than or equal to the key provided.
-
Method Details
-
id
public int id()Return the position in the collector this class occupies.- Specified by:
idin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable>
-
key
Return the key at the head of this RR.- Specified by:
keyin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable>
-
key
Clone the key at the head of this RR into the object supplied.- Specified by:
keyin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable> - Throws:
IOException
-
hasNext
public boolean hasNext()Return true if the RR- including the k,v pair stored in this object- is exhausted.- Specified by:
hasNextin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable>
-
skip
Skip key-value pairs with keys less than or equal to the key provided.- Specified by:
skipin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable> - Throws:
IOException
-
next
Read the next k,v pair into the head of this object; return true iff the RR and this are exhausted.- Throws:
IOException
-
accept
public void accept(org.apache.hadoop.mapred.join.CompositeRecordReader.JoinCollector i, K key) throws IOException 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).- Specified by:
acceptin interfaceComposableRecordReader<K extends WritableComparable,U extends Writable> - Throws:
IOException
-
next
Write key-value pair at the head of this stream to the objects provided; get next key-value pair from proxied RR.- Specified by:
nextin interfaceRecordReader<K extends WritableComparable,U extends Writable> - Parameters:
key- the key to read data intovalue- the value to read data into- Returns:
- true iff a key/value was read, false if at EOF
- Throws:
IOException
-
createKey
Request new key from proxied RR.- Specified by:
createKeyin interfaceRecordReader<K extends WritableComparable,U extends Writable> - Returns:
- a new key object.
-
createValue
Request new value from proxied RR.- Specified by:
createValuein interfaceRecordReader<K extends WritableComparable,U extends Writable> - Returns:
- a new value object.
-
getProgress
Request progress from proxied RR.- Specified by:
getProgressin interfaceRecordReader<K extends WritableComparable,U extends Writable> - Returns:
- progress from
0.0to1.0. - Throws:
IOException
-
getPos
Request position from proxied RR.- Specified by:
getPosin interfaceRecordReader<K extends WritableComparable,U extends Writable> - Returns:
- the current position in the input.
- Throws:
IOException
-
close
Forward close request to proxied RR.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceRecordReader<K extends WritableComparable,U extends Writable> - Throws:
IOException
-
compareTo
Implement Comparable contract (compare key at head of proxied RR with that of another).- Specified by:
compareToin interfaceComparable<K extends WritableComparable>
-
equals
Return true iff compareTo(other) retn true. -
hashCode
public int hashCode() -
setConf
Description copied from interface:ConfigurableSet the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- configuration to be used
-
getConf
Description copied from interface:ConfigurableReturn the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- Configuration
-