org.apache.hadoop.mapreduce.lib.join

## Class CompositeRecordReader.JoinCollector

- java.lang.Object
- - org.apache.hadoop.mapreduce.lib.join.CompositeRecordReader.JoinCollector

- Enclosing class:
    CompositeRecordReader<K extends org.apache.hadoop.io.WritableComparable<?>,V extends org.apache.hadoop.io.Writable,X extends org.apache.hadoop.io.Writable>

      public class CompositeRecordReader.JoinCollector
      extends Object

  Collector for join values. This accumulates values for a given key from the child RecordReaders. If one or more child RR contain duplicate keys, this will emit the cross product of the associated values until exhausted.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JoinCollector(int card)` Construct a collector capable of handling the specified number of children.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int id, ResetableIterator<X> i)` Register a given iterator at position id.
    `void` | `clear()` Clear all state information.
    `void` | `close()` Close all child iterators.
    `boolean` | `flush(TupleWritable value)` Write the next value into key, value as accepted by the operation associated with this set of RecordReaders.
    `boolean` | `hasNext()` Returns false if exhausted or if reset(K) has not been called.
    `K` | `key()` Return the key associated with this collection.
    `protected boolean` | `next(TupleWritable val)` Populate Tuple from iterators.
    `boolean` | `replay(TupleWritable val)` Replay the last Tuple emitted.
    `void` | `reset(K key)` Codify the contents of the collector to be iterated over.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JoinCollector

          public JoinCollector(int card)

      Construct a collector capable of handling the specified number of children.

  - ### Method Detail

    - #### add

          public void add(int id,
                          ResetableIterator<X> i)
                   throws IOException

      Register a given iterator at position id.
      Throws:
        `IOException`

    - #### key

          public K key()

      Return the key associated with this collection.

    - #### reset

          public void reset(K key)

      Codify the contents of the collector to be iterated over. When this is called, all RecordReaders registered for this key should have added ResetableIterators.

    - #### clear

          public void clear()

      Clear all state information.

    - #### hasNext

          public boolean hasNext()

      Returns false if exhausted or if reset(K) has not been called.

    - #### next

          protected boolean next(TupleWritable val)
                          throws IOException

      Populate Tuple from iterators. It should be the case that, given iterators i_1...i_n over values from sources s_1...s_n sharing key k, repeated calls to next should yield I x I.
      Throws:
        `IOException`

    - #### replay

          public boolean replay(TupleWritable val)
                         throws IOException

      Replay the last Tuple emitted.
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Close all child iterators.
      Throws:
        `IOException`

    - #### flush

          public boolean flush(TupleWritable value)
                        throws IOException

      Write the next value into key, value as accepted by the operation associated with this set of RecordReaders.
      Throws:
        `IOException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.