org.apache.hadoop.mapreduce.lib.join

## Class CompositeInputSplit

- java.lang.Object
- - org.apache.hadoop.mapreduce.InputSplit
  - - org.apache.hadoop.mapreduce.lib.join.CompositeInputSplit

- All Implemented Interfaces:
    Writable

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class CompositeInputSplit
      extends InputSplit
      implements Writable

  This InputSplit contains a set of child InputSplits. Any InputSplit inserted into this collection must have a public default constructor.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeInputSplit()`
    `CompositeInputSplit(int capacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(InputSplit s)` Add an InputSplit to this collection.
    `InputSplit` | `get(int i)` Get ith child InputSplit.
    `long` | `getLength()` Return the aggregate length of all child InputSplits currently added.
    `long` | `getLength(int i)` Get the length of ith child InputSplit.
    `String[]` | `getLocation(int i)` getLocations from ith InputSplit.
    `String[]` | `getLocations()` Collect a set of hosts from all child InputSplits.
    `void` | `readFields(DataInput in)` Deserialize the fields of this object from `in`.
    `void` | `write(DataOutput out)` Write splits in the following format.

    - ### Methods inherited from class org.apache.hadoop.mapreduce.InputSplit

      `getLocationInfo`

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

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

- - ### Constructor Detail

    - #### CompositeInputSplit

          public CompositeInputSplit()

    - #### CompositeInputSplit

          public CompositeInputSplit(int capacity)

  - ### Method Detail

    - #### add

          public void add(InputSplit s)
                   throws IOException,
                          InterruptedException

      Add an InputSplit to this collection.
      Throws:
        `IOException` - If capacity was not specified during construction or if capacity has been reached.
        `InterruptedException`

    - #### get

          public InputSplit get(int i)

      Get ith child InputSplit.

    - #### getLength

          public long getLength()
                         throws IOException

      Return the aggregate length of all child InputSplits currently added.
      Specified by:
        `getLength` in class `InputSplit`
      Returns:
        the number of bytes in the split
      Throws:
        `IOException`

    - #### getLength

          public long getLength(int i)
                         throws IOException,
                                InterruptedException

      Get the length of ith child InputSplit.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getLocations

          public String[] getLocations()
                                throws IOException,
                                       InterruptedException

      Collect a set of hosts from all child InputSplits.
      Specified by:
        `getLocations` in class `InputSplit`
      Returns:
        a new array of the node nodes.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getLocation

          public String[] getLocation(int i)
                               throws IOException,
                                      InterruptedException

      getLocations from ith InputSplit.
      Throws:
        `IOException`
        `InterruptedException`

    - #### write

          public void write(DataOutput out)
                     throws IOException

      Write splits in the following format. `<count><class1><class2>...<classn><split1><split2>...<splitn>`
      Specified by:
        `write` in interface `Writable`
      Parameters:
        `out` - `DataOuput` to serialize this object into.
      Throws:
        `IOException`

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Deserialize the fields of this object from `in`.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Specified by:
        `readFields` in interface `Writable`
      Parameters:
        `in` - `DataInput` to deseriablize this object from.
      Throws:
        `IOException` - If the child InputSplit cannot be read, typically for failing access checks.

Copyright © 2022 Apache Software Foundation. All rights reserved.