Package org.apache.hadoop.hbase.io.hfile
Class CompoundBloomFilter
java.lang.Object
org.apache.hadoop.hbase.io.hfile.CompoundBloomFilterBase
org.apache.hadoop.hbase.io.hfile.CompoundBloomFilter
- All Implemented Interfaces:
BloomFilter
,BloomFilterBase
A Bloom filter implementation built on top of
BloomFilterChunk
, 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
FieldsModifier and TypeFieldDescriptionprivate Hash
private int
private HFileBlockIndex.BlockIndexReader
private final BloomFilterMetrics
private long[]
private long[]
private HFile.Reader
Used to load chunks on demandFields inherited from class org.apache.hadoop.hbase.io.hfile.CompoundBloomFilterBase
comparator, errorRate, hashType, numChunks, totalByteSize, totalKeyCount, totalMaxKeys, VERSION
-
Constructor Summary
ConstructorsConstructorDescriptionCompoundBloomFilter
(DataInput meta, HFile.Reader reader, BloomFilterMetrics metrics) De-serialization for compound Bloom filter metadata. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if the specified key is contained in the bloom filter.boolean
Check if the specified key is contained in the bloom filter.private boolean
containsInternal
(byte[] key, int keyOffset, int keyLength, ByteBuff bloom) private boolean
containsInternal
(Cell keyCell, ByteBuff bloom, BloomType type) void
private HFileBlock
getBloomBlock
(int block) int
long
getNumPositivesForTesting
(int chunk) long
getNumQueriesForTesting
(int chunk) boolean
toString()
Methods inherited from class org.apache.hadoop.hbase.io.hfile.CompoundBloomFilterBase
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
getByteSize, getKeyCount, getMaxKeys
-
Field Details
-
reader
Used to load chunks on demand -
metrics
-
index
-
hashCount
-
hash
-
numQueriesPerChunk
-
numPositivesPerChunk
-
-
Constructor Details
-
CompoundBloomFilter
public CompoundBloomFilter(DataInput meta, HFile.Reader reader, BloomFilterMetrics metrics) throws IOException De-serialization for compound Bloom filter metadata. Must be consistent with whatCompoundBloomFilterWriter
does.- Parameters:
meta
- serialized Bloom filter metadata without any magic blocksreader
- reader for hfilemetrics
- for collecting bloom filter metrics. may be null- Throws:
IOException
-
-
Method Details
-
contains
Description copied from interface:BloomFilter
Check if the specified key is contained in the bloom filter.- Specified by:
contains
in interfaceBloomFilter
- 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
-
containsInternal
-
getBloomBlock
-
contains
Description copied from interface:BloomFilter
Check if the specified key is contained in the bloom filter.- Specified by:
contains
in interfaceBloomFilter
- Parameters:
keyCell
- the key to check for the existence ofbloom
- bloom filter data to search. This can be null if auto-loading is supported.type
- The type of Bloom ROW/ ROW_COL- Returns:
- true if matched by bloom, false if not
-
containsInternal
-
supportsAutoLoading
- Specified by:
supportsAutoLoading
in interfaceBloomFilter
- Returns:
- true if this Bloom filter can automatically load its data and thus allows a null byte buffer to be passed to contains()
-
getNumChunks
-
enableTestingStats
-
formatTestingStats
-
getNumQueriesForTesting
-
getNumPositivesForTesting
-
toString
-