I have not tried this, but from the second link you provided, it seems that this is available in an environment variable called map.input.file
. Then, this should work:
Sys.getenv("map.input.file")
EDIT: Upon further investigation, I learned that you need to replace the dots with underscores, so this is the way to do it:
Sys.getenv("map_input_file")
However, the map.input.file property has been deprecated in YARN (Hadoop 2.x), so the new name should be used instead:
Sys.getenv("mapreduce_map_input_file")