@Test public void testCreateRecordReader() throws IOException, InterruptedException { BlurInputFormat format = new BlurInputFormat(); Configuration conf = new Configuration(); Job job = new Job(conf); FileInputFormat.addInputPath(job, indexPath); JobID jobId = new JobID(); JobContext context = new JobContext(job.getConfiguration(), jobId); List<InputSplit> list = format.getSplits(context); for (int i = 0; i < list.size(); i++) { BlurInputSplit split = (BlurInputSplit) list.get(i); TaskAttemptID taskId = new TaskAttemptID(); TaskAttemptContext taskContext = new TaskAttemptContext(conf, taskId); RecordReader<Text, BlurRecord> reader = format.createRecordReader(split, taskContext); while (reader.nextKeyValue()) { System.out.println(reader.getProgress() + " " + reader.getCurrentKey() + " " + reader.getCurrentValue()); } } }
@Override public RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { BlurRecordReader blurRecordReader = new BlurRecordReader(); blurRecordReader.initialize(split, context); return blurRecordReader; }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @Override public RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { BlurRecordReader blurRecordReader = new BlurRecordReader(); blurRecordReader.initialize(split, context); return blurRecordReader; } }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @Override public RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { BlurRecordReader blurRecordReader = new BlurRecordReader(); blurRecordReader.initialize(split, context); return blurRecordReader; }  }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @Override public RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { BlurRecordReader blurRecordReader = new BlurRecordReader(); blurRecordReader.initialize(split, context); return blurRecordReader; }  @SuppressWarnings("unchecked") @Override List<InputSplit> getSplits(JobContext context); @Override RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context); static void findAllSegments(Configuration configuration, Path path, List<?> splits); @SuppressWarnings("unchecked") static void addSplits(HdfsDirectory directory, @SuppressWarnings("rawtypes") List splits); }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @Override public RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { BlurRecordReader blurRecordReader = new BlurRecordReader(); blurRecordReader.initialize(split, context); return blurRecordReader; }  @SuppressWarnings("unchecked") @Override List<InputSplit> getSplits(JobContext context); @Override RecordReader<Text, BlurRecord> createRecordReader(InputSplit split, TaskAttemptContext context); static void findAllSegments(Configuration configuration, Path path, List<?> splits); @SuppressWarnings("unchecked") static void addSplits(HdfsDirectory directory, @SuppressWarnings("rawtypes") List splits);  }