Package org.apache.hadoop.io
Class BloomMapFile.Reader
java.lang.Object
org.apache.hadoop.io.MapFile.Reader
org.apache.hadoop.io.BloomMapFile.Reader
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- BloomMapFile
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.io.MapFile.Reader
MapFile.Reader.Option -
Constructor Summary
ConstructorsConstructorDescriptionReader(FileSystem fs, String dirName, Configuration conf) Deprecated.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) Deprecated.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf, boolean open) Deprecated.Reader(Path dir, Configuration conf, SequenceFile.Reader.Option... options) -
Method Summary
Modifier and TypeMethodDescriptionget(WritableComparable key, Writable val) Fast version of theMapFile.Reader.get(WritableComparable, Writable)method.Retrieve the Bloom filter used by this instance of the Reader.booleanChecks if this MapFile has the indicated key.Methods inherited from class org.apache.hadoop.io.MapFile.Reader
close, comparator, createDataFileReader, finalKey, getClosest, getClosest, getKeyClass, getValueClass, midKey, next, open, reset, seek
-
Constructor Details
-
Reader
public Reader(Path dir, Configuration conf, SequenceFile.Reader.Option... options) throws IOException - Throws:
IOException
-
Reader
Deprecated.- Throws:
IOException
-
Reader
@Deprecated public Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf, boolean open) throws IOException Deprecated.- Throws:
IOException
-
Reader
@Deprecated public Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) throws IOException Deprecated.- Throws:
IOException
-
-
Method Details
-
probablyHasKey
Checks if this MapFile has the indicated key. The membership test is performed using a Bloom filter, so the result has always non-zero probability of false positives.- Parameters:
key- key to check- Returns:
- false iff key doesn't exist, true if key probably exists.
- Throws:
IOException- raised on errors performing I/O.
-
get
Fast version of theMapFile.Reader.get(WritableComparable, Writable)method. First it checks the Bloom filter for the existence of the key, and only if present it performs the real get operation. This yields significant performance improvements for get operations on sparsely populated files.- Overrides:
getin classMapFile.Reader- Parameters:
key- key.val- val.- Returns:
- Writable if such a pair exists true,not false.
- Throws:
IOException- raised on errors performing I/O.
-
getBloomFilter
Retrieve the Bloom filter used by this instance of the Reader.- Returns:
- a Bloom filter (see
Filter)
-