@Test public void testGetSplits() 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); Path path = new Path(indexPath,BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, i)); FileSystem fileSystem = path.getFileSystem(conf); assertEquals(new BlurInputSplit(fileSystem.makeQualified(path), "_0", 0, Integer.MAX_VALUE), split); } }
@SuppressWarnings("unchecked") @Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { List<?> splits = new ArrayList<Object>(); Path[] paths = FileInputFormat.getInputPaths(context); for (Path path : paths) { findAllSegments(context.getConfiguration(),path,splits); } return (List<InputSplit>) splits; }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @SuppressWarnings("unchecked") @Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { List<?> splits = new ArrayList<Object>(); Path[] paths = FileInputFormat.getInputPaths(context); for (Path path : paths) { findAllSegments(context.getConfiguration(),path,splits); } return (List<InputSplit>) splits; } }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @SuppressWarnings("unchecked") @Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { List<?> splits = new ArrayList<Object>(); Path[] paths = FileInputFormat.getInputPaths(context); for (Path path : paths) { findAllSegments(context.getConfiguration(),path,splits); } return (List<InputSplit>) splits; }  }
BlurInputFormat extends InputFormat<Text,BlurRecord> { @SuppressWarnings("unchecked") @Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { List<?> splits = new ArrayList<Object>(); Path[] paths = FileInputFormat.getInputPaths(context); for (Path path : paths) { findAllSegments(context.getConfiguration(),path,splits); } return (List<InputSplit>) splits; }  @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> { @SuppressWarnings("unchecked") @Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { List<?> splits = new ArrayList<Object>(); Path[] paths = FileInputFormat.getInputPaths(context); for (Path path : paths) { findAllSegments(context.getConfiguration(),path,splits); } return (List<InputSplit>) splits; }  @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);  }