Example usage for org.apache.hadoop.mapred.lib CombineFileRecordReader CombineFileRecordReader

List of usage examples for org.apache.hadoop.mapred.lib CombineFileRecordReader CombineFileRecordReader

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred.lib CombineFileRecordReader CombineFileRecordReader.

Prototype

public CombineFileRecordReader(JobConf job, CombineFileSplit split, Reporter reporter,
        Class<RecordReader<K, V>> rrClass) throws IOException 

Source Link

Document

A generic RecordReader that can hand out different recordReaders for each chunk in the CombineFileSplit.

Usage

From source file:com.ricemap.spateDB.mapred.SpatialInputFormat.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//  ww  w  .j a va  2  s.  com
public RecordReader<K, V> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException {
    if (compressionCodecs == null)
        compressionCodecs = new CompressionCodecFactory(job);
    if (split instanceof CombineFileSplit) {
        return new CombineFileRecordReader<K, V>(job, (CombineFileSplit) split, reporter,
                (Class<RecordReader<K, V>>) rrClass);
    } else if (split instanceof FileSplit) {
        try {
            @SuppressWarnings("rawtypes")
            Constructor<? extends RecordReader> rrConstructor;
            rrConstructor = rrClass.getDeclaredConstructor(constructorSignature);
            rrConstructor.setAccessible(true);
            return rrConstructor.newInstance(new Object[] { job, (FileSplit) split });
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        throw new RuntimeException("Cannot generate a record reader");
    } else {
        throw new RuntimeException("Cannot handle splits of type " + split.getClass());
    }
}

From source file:org.easycloud.las.analyzer.io.CombinedInputFormat.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//from   w ww . j a v  a 2 s.c  o  m
public RecordReader<LongWritable, Text> getRecordReader(InputSplit split, JobConf conf, Reporter reporter)
        throws IOException {
    reporter.setStatus(split.toString());
    return new CombineFileRecordReader(conf, (CombineFileSplit) split, reporter,
            DefaultCombineFileRecordReader.class);
}

From source file:org.icgc.dcc.release.core.hadoop.CombineSequenceInputFormat.java

License:Open Source License

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public RecordReader<NullWritable, BytesWritable> getRecordReader(InputSplit split, JobConf conf,
        Reporter reporter) throws IOException {
    return new CombineFileRecordReader(conf, (CombineFileSplit) split, reporter, BiteRecordReaderWrapper.class);
}

From source file:org.icgc.dcc.release.core.hadoop.CombineTextInputFormat.java

License:Open Source License

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public RecordReader<LongWritable, Text> getRecordReader(InputSplit split, JobConf conf, Reporter reporter)
        throws IOException {
    return new CombineFileRecordReader(conf, (CombineFileSplit) split, reporter, TextRecordReaderWrapper.class);
}