コード例 #1
0
 @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);
   }
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
 public static void addInputPath(Job job, Path path) throws IOException {
   job.getConfiguration().setBoolean("file", true);
   SequenceFileAsBinaryInputFormat.addInputPaths(job, path.toString());
 }