Skip to content

Instantly share code, notes, and snippets.

@tf0054
Created March 22, 2012 14:48
Show Gist options
  • Save tf0054/2158743 to your computer and use it in GitHub Desktop.
Save tf0054/2158743 to your computer and use it in GitHub Desktop.
Hack#15
package org.hadoophacks.mapreduce.lib.input;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.CombineFileRecordReader;
import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
import org.apache.hadoop.conf.Configuration;
public class CustomCombineFileInputFormat extends
CombineFileInputFormat<Text, Text> {
public RecordReader<Text, Text> createRecordReader(
InputSplit split, TaskAttemptContext context) {
try {
Configuration conf = context.getConfiguration();
CombineFileRecordReader<Text, Text> reader = new CombineFileRecordReader<Text, Text>(
(CombineFileSplit) split, context, CombineFileLineRecordReader.class);
return reader;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment