@InterfaceAudience.Private public class CompoundBloomFilter extends CompoundBloomFilterBase implements BloomFilter
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.Modifier and Type | Field and Description |
---|---|
private Hash |
hash |
private int |
hashCount |
private HFileBlockIndex.BlockIndexReader |
index |
private BloomFilterMetrics |
metrics |
private long[] |
numPositivesPerChunk |
private long[] |
numQueriesPerChunk |
private HFile.Reader |
reader
Used to load chunks on demand
|
comparator, errorRate, hashType, numChunks, totalByteSize, totalKeyCount, totalMaxKeys, VERSION
Constructor and Description |
---|
CompoundBloomFilter(DataInput meta,
HFile.Reader reader,
BloomFilterMetrics metrics)
De-serialization for compound Bloom filter metadata.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(byte[] key,
int keyOffset,
int keyLength,
ByteBuff bloom)
Check if the specified key is contained in the bloom filter.
|
boolean |
contains(Cell keyCell,
ByteBuff bloom,
BloomType type)
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 |
enableTestingStats() |
String |
formatTestingStats() |
private HFileBlock |
getBloomBlock(int block) |
int |
getNumChunks() |
long |
getNumPositivesForTesting(int chunk) |
long |
getNumQueriesForTesting(int chunk) |
boolean |
supportsAutoLoading() |
String |
toString() |
getByteSize, getKeyCount, getMaxKeys
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getByteSize, getKeyCount, getMaxKeys
private HFile.Reader reader
private final BloomFilterMetrics metrics
private HFileBlockIndex.BlockIndexReader index
private int hashCount
private long[] numQueriesPerChunk
private long[] numPositivesPerChunk
public CompoundBloomFilter(DataInput meta, HFile.Reader reader, BloomFilterMetrics metrics) throws IOException
CompoundBloomFilterWriter
does.meta
- serialized Bloom filter metadata without any magic blocksreader
- reader for hfilemetrics
- for collecting bloom filter metrics. may be nullIOException
public boolean contains(byte[] key, int keyOffset, int keyLength, ByteBuff bloom)
BloomFilter
contains
in interface BloomFilter
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.private boolean containsInternal(byte[] key, int keyOffset, int keyLength, ByteBuff bloom)
private HFileBlock getBloomBlock(int block)
public boolean contains(Cell keyCell, ByteBuff bloom, BloomType type)
BloomFilter
contains
in interface BloomFilter
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_COLprivate boolean containsInternal(Cell keyCell, ByteBuff bloom, BloomType type)
public boolean supportsAutoLoading()
supportsAutoLoading
in interface BloomFilter
public int getNumChunks()
public void enableTestingStats()
public String formatTestingStats()
public long getNumQueriesForTesting(int chunk)
public long getNumPositivesForTesting(int chunk)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.