org.apache.hadoop.hbase.util
Class CompoundBloomFilter
java.lang.Object
org.apache.hadoop.hbase.util.CompoundBloomFilterBase
org.apache.hadoop.hbase.util.CompoundBloomFilter
- All Implemented Interfaces:
- BloomFilter, BloomFilterBase
@InterfaceAudience.Private
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.
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
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 ofkeyOffset
- offset into the datakeyLength
- length of the databloom
- 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 KeyValue.KVComparator 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 © 2015 The Apache Software Foundation. All rights reserved.