## 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

Enclosing class:
  BloomMapFile

    public static class BloomMapFile.Reader

extends MapFile.Reader

Constructor Summary
`BloomMapFile.Reader(FileSystem fs, String dirName, Configuration conf)`
`BloomMapFile.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf)`
`BloomMapFile.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf, boolean open)`

Method Summary
`Writable` `get(WritableComparable key, Writable val)` Fast version of the `MapFile.Reader.get(WritableComparable, Writable)` method.
`Filter` `getBloomFilter()` Retrieve the Bloom filter used by this instance of the Reader.
`boolean` `probablyHasKey(WritableComparable key)` Checks if this MapFile has the indicated key.

Methods inherited from class org.apache.hadoop.io.MapFile.Reader
`close, createDataFileReader, finalKey, getClosest, getClosest, getKeyClass, getValueClass, midKey, next, open, reset, seek`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BloomMapFile.Reader

    public BloomMapFile.Reader(FileSystem fs,
                               String dirName,
                               Configuration conf)
                        throws IOException

Throws:
  `IOException`

### BloomMapFile.Reader

    public BloomMapFile.Reader(FileSystem fs,
                               String dirName,
                               WritableComparator comparator,
                               Configuration conf,
                               boolean open)
                        throws IOException

Throws:
  `IOException`

### BloomMapFile.Reader

    public BloomMapFile.Reader(FileSystem fs,
                               String dirName,
                               WritableComparator comparator,
                               Configuration conf)
                        throws IOException

Throws:
  `IOException`

Method Detail

### probablyHasKey

    public boolean probablyHasKey(WritableComparable key)
                           throws IOException

  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`

### get

    public Writable get(WritableComparable key,
                        Writable val)
                 throws IOException

  Fast version of the `MapFile.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:
    `get` in class `MapFile.Reader`
  Throws:
    `IOException`

### getBloomFilter

    public Filter getBloomFilter()

  Retrieve the Bloom filter used by this instance of the Reader.

  Returns:
    a Bloom filter (see `Filter`)

Copyright © 2009 The Apache Software Foundation