5.4.2 mapFile
(1 ) the definition of
MapFile is the SequeneceFile sorted, the sequenceFile files sorted by key values, and provides an index for fast retrieval.
(2 ) Index
Every index value is 128 (default 128, can be modified by io.map.index.interval) takes a key composed of keys, the index is loaded into memory for quick retrieval mapfile file.
(3 ) read and write
Very similar sequenceFile, only need to be replaced MapFile.Reader and MapFile.Writer it. When performing file write operation, the file is unreadable. MapFile file to ensure that key-value ordering (based on key) is by examining the mechanisms at each key-value write-once, this checking mechanism is very simple, is to ensure that key-value is currently being written on a just and writing key-value meets a set sequence. Non-decreasing order does not meet the key, it will direct error, it is written in an orderly sequence, not automatic to sort of key-value inputs.
At the command line displays the contents of the file mapFile also use the -text
(4)SequenceFile转mapFile
mapFile since it is SequenceFile sorted and indexed so natural can be converted to SequenceFile MapFile use mapFile.fix () method to convert the file into a SequenceFile MapFile.
(5 ) MAPFILE variants
SetFile |
Writable memory key |
ArrayFile |
Key is an integer indicating an index in the array, the value of writable |
BlooMapFile |
Bloom filter using dynamic key is detected in the map. |
(6 ) stored in a column-oriented manner
Stored by row. Sequential file, and the file storage Avro map data files are line-oriented, i.e., each row of data is continuous in the storage file.
Stored in columns. Row lines is divided into slices file, then the first column of each row successively stored in a file.
Himself developed an intelligent stock analysis software, very powerful, you need to click on the link below to obtain: