org.apache.hadoop.mapred.join
Class MultiFilterRecordReader<K extends WritableComparable,V extends Writable>

java.lang.Object
  extended by org.apache.hadoop.mapred.join.CompositeRecordReader<K,V,V>
      extended by org.apache.hadoop.mapred.join.MultiFilterRecordReader<K,V>
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
OverrideRecordReader

public abstract class MultiFilterRecordReader<K extends WritableComparable,V extends Writable>
extends CompositeRecordReader<K,V,V>

Base class for Composite join returning values derived from multiple sources, but generally not tuples.


Nested Class Summary
protected  class MultiFilterRecordReader.MultiFilterDelegationIterator
          Proxy the JoinCollector, but include callback to emit.
 
Field Summary
 
Fields inherited from class org.apache.hadoop.mapred.join.CompositeRecordReader
jc, kids
 
Constructor Summary
MultiFilterRecordReader(int id, JobConf conf, int capacity, Class<? extends WritableComparator> cmpcl)
           
 
Method Summary
 void accept(org.apache.hadoop.mapred.join.CompositeRecordReader.JoinCollector jc, K key)
          While key-value pairs from this RecordReader match the given key, register them with the JoinCollector provided.
protected  boolean combine(Object[] srcs, TupleWritable dst)
          Default implementation offers emit(org.apache.hadoop.mapred.join.TupleWritable) every Tuple from the collector (the outer join of child RRs).
 V createValue()
          Create an object of the appropriate type to be used as a value.
protected abstract  V emit(TupleWritable dst)
          For each tuple emitted, return a value (typically one of the values in the tuple).
protected  ResetableIterator<V> getDelegate()
          Return an iterator returning a single value from the tuple.
 boolean hasNext()
          Returns true if the stream is not empty, but provides no guarantee that a call to next(K,V) will succeed.
 int id()
          Return the position in the collector this class occupies.
 K key()
          Return the key this RecordReader would supply on a call to next(K,V)
 void key(K key)
          Clone the key at the head of this RecordReader into the object provided.
 boolean next(K key, V value)
          Reads the next key/value pair from the input for processing.
 void skip(K key)
          Skip key-value pairs with keys less than or equal to the key provided.
 
Methods inherited from class org.apache.hadoop.mapred.join.CompositeRecordReader
accept, add, close, compareTo, createInternalValue, createKey, fillJoinCollector, getComparator, getConf, getPos, getProgress, getRecordReaderQueue, hasNext, id, key, key, setConf, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.mapred.RecordReader
close, createKey, getPos, getProgress
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

MultiFilterRecordReader

public MultiFilterRecordReader(int id,
                               JobConf conf,
                               int capacity,
                               Class<? extends WritableComparator> cmpcl)
                        throws IOException
Throws:
IOException
Method Detail

emit

protected abstract V emit(TupleWritable dst)
                                    throws IOException
For each tuple emitted, return a value (typically one of the values in the tuple). Modifying the Writables in the tuple is permitted and unlikely to affect join behavior in most cases, but it is not recommended. It's safer to clone first.

Throws:
IOException

combine

protected boolean combine(Object[] srcs,
                          TupleWritable dst)
Default implementation offers emit(org.apache.hadoop.mapred.join.TupleWritable) every Tuple from the collector (the outer join of child RRs).

Specified by:
combine in class CompositeRecordReader<K extends WritableComparable,V extends Writable,V extends Writable>

next

public boolean next(K key,
                    V value)
             throws IOException
Reads the next key/value pair from the input for processing.

Parameters:
key - the key to read data into
value - the value to read data into
Returns:
true iff a key/value was read, false if at EOF
Throws:
IOException
See Also:
Writable.readFields(DataInput)

createValue

public V createValue()
Create an object of the appropriate type to be used as a value.

Returns:
a new value object.

getDelegate

protected ResetableIterator<V> getDelegate()
Return an iterator returning a single value from the tuple.

Specified by:
getDelegate in class CompositeRecordReader<K extends WritableComparable,V extends Writable,V extends Writable>
See Also:
MultiFilterRecordReader.MultiFilterDelegationIterator

id

public int id()
Return the position in the collector this class occupies.


key

public K key()
Return the key this RecordReader would supply on a call to next(K,V)


key

public void key(K key)
         throws IOException
Clone the key at the head of this RecordReader into the object provided.

Throws:
IOException

hasNext

public boolean hasNext()
Returns true if the stream is not empty, but provides no guarantee that a call to next(K,V) will succeed.


skip

public void skip(K key)
          throws IOException
Skip key-value pairs with keys less than or equal to the key provided.

Throws:
IOException

accept

public void accept(org.apache.hadoop.mapred.join.CompositeRecordReader.JoinCollector jc,
                   K key)
            throws IOException
While key-value pairs from this RecordReader match the given key, register them with the JoinCollector provided.

Throws:
IOException


Copyright © 2006 The Apache Software Foundation