/// <summary>Get the record reader for the next chunk in this CombineFileSplit.</summary> /// <exception cref="System.IO.IOException"/> protected internal virtual bool InitNextRecordReader() { if (curReader != null) { curReader.Close(); curReader = null; if (idx > 0) { progress += split.GetLength(idx - 1); } } // done processing so far // if all chunks have been processed, nothing more to do. if (idx == split.GetNumPaths()) { return(false); } reporter.Progress(); // get a record reader for the idx-th chunk try { curReader = rrConstructor.NewInstance(new object[] { split, jc, reporter, Sharpen.Extensions.ValueOf (idx) }); // setup some helper config variables. jc.Set(JobContext.MapInputFile, split.GetPath(idx).ToString()); jc.SetLong(JobContext.MapInputStart, split.GetOffset(idx)); jc.SetLong(JobContext.MapInputPath, split.GetLength(idx)); } catch (Exception e) { throw new RuntimeException(e); } idx++; return(true); }
/// <exception cref="System.IO.IOException"/> protected internal CombineFileRecordReaderWrapper(FileInputFormat <K, V> inputFormat , CombineFileSplit split, Configuration conf, Reporter reporter, int idx) { FileSplit fileSplit = new FileSplit(split.GetPath(idx), split.GetOffset(idx), split .GetLength(idx), split.GetLocations()); delegate_ = inputFormat.GetRecordReader(fileSplit, (JobConf)conf, reporter); }