Configuration conf = context.getConfiguration();
// we don't currently allow datasets as the format between map and reduce stages, otherwise we'll have to
// pass in the stage here instead of hardcoding mapper.
MapReduceContextProvider contextProvider = new MapReduceContextProvider(context, MapReduceMetrics.TaskType.Mapper);
BasicMapReduceContext mrContext = contextProvider.get();
mrContext.getMetricsCollectionService().startAndWait();
String dataSetName = getInputName(conf);
BatchReadable<KEY, VALUE> inputDataset = (BatchReadable<KEY, VALUE>) mrContext.getDataSet(dataSetName);
SplitReader<KEY, VALUE> splitReader = inputDataset.createSplitReader(inputSplit.getSplit());
// the record reader now owns the context and will close it
return new DataSetRecordReader<KEY, VALUE>(splitReader, mrContext, dataSetName);
}