InputSplit inputSplit = context.getInputSplit(); String filename = ((FileSplit)inputSplit).getPath().getName();
InputSplit inputSplit = context.getInputSplit(); long startByte = ((FileSplit)inputSplit).getStart(); long endByte = startByte + inputSplit.getLength() - 1;This code calculates the byte offset of the input split by getting the starting byte and adding the length of the split minus one. This gives the range of bytes that are being read by the split. Package/Library: org.apache.hadoop.mapreduce Overall, Context.getInputSplit() is a useful method for getting information about the input data being processed by a map task in a Hadoop MapReduce job. It is part of the org.apache.hadoop.mapreduce package.