Search in sources :

Example 1 with LineRecordReader

use of org.apache.hadoop.mapreduce.lib.input.LineRecordReader in project hadoop-connectors by GoogleCloudDataproc.

the class GsonRecordReader method initialize.

/**
 * Called once at initialization to initialize the RecordReader.
 *
 * @param genericSplit the split that defines the range of records to read.
 * @param context the information about the task.
 * @throws IOException on IO Error.
 */
@Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException {
    if (logger.atFine().isEnabled()) {
        logger.atFine().log("initialize('%s', '%s')", HadoopToStringUtil.toString(genericSplit), HadoopToStringUtil.toString(context));
    }
    checkArgument(genericSplit instanceof FileSplit, "InputSplit genericSplit should be an instance of FileSplit.");
    // Get FileSplit.
    FileSplit fileSplit = (FileSplit) genericSplit;
    // Initialize the LineRecordReader.
    lineReader = new LineRecordReader();
    lineReader.initialize(fileSplit, context);
}
Also used : LineRecordReader(org.apache.hadoop.mapreduce.lib.input.LineRecordReader) FileSplit(org.apache.hadoop.mapreduce.lib.input.FileSplit)

Aggregations

FileSplit (org.apache.hadoop.mapreduce.lib.input.FileSplit)1 LineRecordReader (org.apache.hadoop.mapreduce.lib.input.LineRecordReader)1