@InterfaceAudience.Private public class BloomFilterChunk extends Object implements BloomFilterBase
CompoundBloomFilter| Modifier and Type | Field and Description |
|---|---|
protected ByteBuffer |
bloom
Bloom bits
|
protected BloomType |
bloomType
The type of bloom
|
protected long |
byteSize
Bytes (B) in the array.
|
protected Hash |
hash
Hash Function
|
protected int |
hashCount
Number of hash functions
|
protected int |
hashType
Hash type
|
protected int |
keyCount
Keys currently in the bloom
|
protected int |
maxKeys
Max Keys expected for the bloom
|
| Constructor and Description |
|---|
BloomFilterChunk(DataInput meta)
Loads bloom filter meta data from file input.
|
BloomFilterChunk(int hashType,
BloomType bloomType) |
BloomFilterChunk(int maxKeys,
double errorRate,
int hashType,
int foldFactor)
Determines & initializes bloom filter meta data from user config.
|
| Modifier and Type | Method and Description |
|---|---|
double |
actualErrorRate()
Computes the error rate for this Bloom filter, taking into account the actual number of hash
functions and keys inserted.
|
void |
add(Cell cell) |
void |
allocBloom() |
void |
compactBloom() |
BloomFilterChunk |
createAnother()
Creates another similar Bloom filter.
|
long |
getByteSize()
Returns Size of the bloom, in bytes
|
int |
getHashCount() |
int |
getHashType() |
long |
getKeyCount()
Returns The number of keys added to the bloom
|
long |
getMaxKeys()
Returns The max number of keys that can be inserted to maintain the desired error rate
|
String |
toString() |
void |
writeBloom(DataOutput out)
Writes just the bloom filter to the output array
|
protected long byteSize
protected int hashCount
protected final int hashType
protected final Hash hash
protected int keyCount
protected int maxKeys
protected ByteBuffer bloom
protected BloomType bloomType
public BloomFilterChunk(DataInput meta) throws IOException, IllegalArgumentException
meta - stored bloom meta dataIllegalArgumentException - meta data is invalidIOExceptionpublic BloomFilterChunk(int hashType,
BloomType bloomType)
public BloomFilterChunk(int maxKeys,
double errorRate,
int hashType,
int foldFactor)
throws IllegalArgumentException
allocBloom() to allocate bloom filter data.maxKeys - Maximum expected number of keys that will be stored in this bloomerrorRate - Desired false positive error rate. Lower rate = more storage requiredhashType - Type of hash function to usefoldFactor - When finished adding entries, you may be able to 'fold' this bloom to save
space. Tradeoff potentially excess bytes in bloom for ability to fold if
keyCount is exponentially greater than maxKeys.IllegalArgumentExceptionpublic double actualErrorRate()
public BloomFilterChunk createAnother()
public void allocBloom()
public void add(Cell cell)
public long getKeyCount()
BloomFilterBasegetKeyCount in interface BloomFilterBasepublic long getMaxKeys()
BloomFilterBasegetMaxKeys in interface BloomFilterBasepublic long getByteSize()
BloomFilterBasegetByteSize in interface BloomFilterBasepublic int getHashType()
public void compactBloom()
public void writeBloom(DataOutput out) throws IOException
out - OutputStream to place bloomIOException - Error writing bloom arraypublic int getHashCount()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.