MapFile:The MapFile , in reality is a directory that contains two SequenceFiles: the data file "/data" and the index file "/index". The MapFile allows us to append the sorted key/value pairs and it stores the key and the offset in the index. This allows for a fast lookup, as instead of scanning all the records till a key is found, we scan the index, which has lesser entries. After finding the block, we can access our actual file.Writing A MapFileTo write a MapFile, create an instance of MapFile.Writer and call the append method, just like in SequenceFile. Keys must be instances of WritableComparable and values must be Writable, unlike a SequenceFile, where we can have any serialization framework.Reading A MapFileTo read the entries of a MapFile, we create a MapFile.Reader and call the next method till a false is returned, indicating an end of file.The get method can be used for random access lookup. If a value is returned, the entry was found, if null is returned, no value exists for that particular key.In order to prevent a MapFile's index to take up a lot of memory, we can use the setting io.map.index.skip property to load only a fraction of the index keys into the memory. If the value of this setting is 1, it means skip one key for every key in the index, and so on.PDF Download: Most Recent Hadoop Topics