org.apache.hadoop.hbase.util
Class CompoundBloomFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.util.CompoundBloomFilterBase
      extended by org.apache.hadoop.hbase.util.CompoundBloomFilter
All Implemented Interfaces:
BloomFilter, BloomFilterBase

public class CompoundBloomFilter
extends CompoundBloomFilterBase
implements BloomFilter

A Bloom filter implementation built on top of ByteBloomFilter, encapsulating a set of fixed-size Bloom filters written out at the time of HFile generation into the data block stream, and loaded on demand at query time. This class only provides reading capabilities.


Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.util.CompoundBloomFilterBase
comparator, errorRate, hashType, numChunks, totalByteSize, totalKeyCount, totalMaxKeys, VERSION
 
Constructor Summary
CompoundBloomFilter(DataInput meta, HFile.Reader reader)
          De-serialization for compound Bloom filter metadata.
 
Method Summary
 boolean contains(byte[] key, int keyOffset, int keyLength, ByteBuffer bloom)
          Check if the specified key is contained in the bloom filter.
 void enableTestingStats()
           
 String formatTestingStats()
           
 org.apache.hadoop.io.RawComparator<byte[]> getComparator()
           
 int getNumChunks()
           
 long getNumPositivesForTesting(int chunk)
           
 long getNumQueriesForTesting(int chunk)
           
 boolean supportsAutoLoading()
           
 String toString()
           
 
Methods inherited from class org.apache.hadoop.hbase.util.CompoundBloomFilterBase
createBloomKey, getByteSize, getKeyCount, getMaxKeys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.util.BloomFilterBase
createBloomKey, getByteSize, getKeyCount, getMaxKeys
 

Constructor Detail

CompoundBloomFilter

public CompoundBloomFilter(DataInput meta,
                           HFile.Reader reader)
                    throws IOException
De-serialization for compound Bloom filter metadata. Must be consistent with what CompoundBloomFilterWriter does.

Parameters:
meta - serialized Bloom filter metadata without any magic blocks
Throws:
IOException
Method Detail

contains

public boolean contains(byte[] key,
                        int keyOffset,
                        int keyLength,
                        ByteBuffer bloom)
Description copied from interface: BloomFilter
Check if the specified key is contained in the bloom filter.

Specified by:
contains in interface BloomFilter
Parameters:
key - data to check for existence of
keyOffset - offset into the data
keyLength - length of the data
bloom - bloom filter data to search. This can be null if auto-loading is supported.
Returns:
true if matched by bloom, false if not

supportsAutoLoading

public boolean supportsAutoLoading()
Specified by:
supportsAutoLoading in interface BloomFilter
Returns:
true if this Bloom filter can automatically load its data and thus allows a null byte buffer to be passed to contains()

getNumChunks

public int getNumChunks()

getComparator

public org.apache.hadoop.io.RawComparator<byte[]> getComparator()
Specified by:
getComparator in interface BloomFilterBase
Overrides:
getComparator in class CompoundBloomFilterBase
Returns:
Bloom key comparator

enableTestingStats

public void enableTestingStats()

formatTestingStats

public String formatTestingStats()

getNumQueriesForTesting

public long getNumQueriesForTesting(int chunk)

getNumPositivesForTesting

public long getNumPositivesForTesting(int chunk)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.