@Override public RecordReader createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { if (split.getClass().equals(TableSplit.class)) { return tableInputFormat.createRecordReader(split, context); } else { return fileInputFormat.createRecordReader(split, context); } }
@Override public List<InputSplit> getSplits(JobContext context) throws IOException { List<InputSplit> splits = new ArrayList<InputSplit>(); if (conf.getBoolean("table", false)) splits.addAll(tableInputFormat.getSplits(context)); if (conf.getBoolean("file", false)) { splits.addAll(fileInputFormat.getSplits(context)); } context.getConfiguration().setInt("mapred.reduce.tasks", splits.size()); return splits; }
public static void addInputPath(Job job, Path path) throws IOException { job.getConfiguration().setBoolean("file", true); SequenceFileAsBinaryInputFormat.addInputPaths(job, path.toString()); }