Example usage for org.apache.hadoop.mapred.join CompositeInputSplit get

List of usage examples for org.apache.hadoop.mapred.join CompositeInputSplit get

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred.join CompositeInputSplit get.

Prototype

public InputSplit get(int i) 

Source Link

Document

Get ith child InputSplit.

Usage

From source file:org.pooledtimeseries.cartesian.CartesianRecordReader.java

License:Apache License

/**
 * Creates a new instance of the CartesianRecordReader
 * /*from   w w  w  . j  a  v a2 s .c om*/
 * @param split
 * @param conf
 * @param reporter
 * @throws IOException
 */
public CartesianRecordReader(CompositeInputSplit split, JobConf conf, Reporter reporter) throws IOException {
    this.rightConf = conf;
    this.rightIS = split.get(1);
    this.rightReporter = reporter;

    try {
        // Create left record reader
        FileInputFormat<Text, BytesWritable> leftFIF = (FileInputFormat) ReflectionUtils
                .newInstance(Class.forName(conf.get(CartesianInputFormat.LEFT_INPUT_FORMAT)), conf);

        leftRR = leftFIF.getRecordReader(split.get(0), conf, reporter);

        // Create right record reader
        rightFIF = (FileInputFormat) ReflectionUtils
                .newInstance(Class.forName(conf.get(CartesianInputFormat.RIGHT_INPUT_FORMAT)), conf);

        rightRR = rightFIF.getRecordReader(rightIS, rightConf, rightReporter);
    } catch (ClassNotFoundException e) {

        e.printStackTrace();
        throw new IOException(e);
    }

    // Create key value pairs for parsing
    lkey = (K1) this.leftRR.createKey();
    lvalue = (V1) this.leftRR.createValue();

    rkey = (K2) this.rightRR.createKey();
    rvalue = (V2) this.rightRR.createValue();
}