public class BloomFilter extends Object
Modifier and Type | Field and Description |
---|---|
protected org.apache.hive.common.util.BloomFilter.BitSet |
bitSet |
static double |
DEFAULT_FPP |
protected int |
numBits |
protected int |
numHashFunctions |
static int |
START_OF_SERIALIZED_LONGS |
Constructor and Description |
---|
BloomFilter() |
BloomFilter(long expectedEntries) |
BloomFilter(long[] bits,
int numFuncs)
A constructor to support rebuilding the BloomFilter from a serialized representation.
|
BloomFilter(long expectedEntries,
double fpp) |
Modifier and Type | Method and Description |
---|---|
void |
add(byte[] val) |
void |
addBytes(byte[] val,
int offset,
int length) |
void |
addDouble(double val) |
void |
addLong(long val) |
void |
addString(String val) |
static BloomFilter |
deserialize(InputStream in)
Deserialize a bloom filter
Read a byte stream, which was written by serialize(OutputStream, BloomFilter)
into a
BloomFilter |
long[] |
getBitSet() |
int |
getBitSize() |
int |
getNumHashFunctions() |
void |
merge(BloomFilter that)
Merge the specified bloom filter with current bloom filter.
|
static void |
mergeBloomFilterBytes(byte[] bf1Bytes,
int bf1Start,
int bf1Length,
byte[] bf2Bytes,
int bf2Start,
int bf2Length)
Merges BloomFilter bf2 into bf1.
|
void |
reset() |
static void |
serialize(OutputStream out,
BloomFilter bloomFilter)
Serialize a bloom filter
|
long |
sizeInBytes() |
boolean |
test(byte[] val) |
boolean |
testBytes(byte[] val,
int offset,
int length) |
boolean |
testDouble(double val) |
boolean |
testLong(long val) |
boolean |
testString(String val) |
String |
toString() |
public static final double DEFAULT_FPP
protected org.apache.hive.common.util.BloomFilter.BitSet bitSet
protected int numBits
protected int numHashFunctions
public static final int START_OF_SERIALIZED_LONGS
public BloomFilter()
public BloomFilter(long expectedEntries)
public BloomFilter(long expectedEntries, double fpp)
public BloomFilter(long[] bits, int numFuncs)
bits
- - bits are used as such for bitset and are NOT copied, any changes to bits will affect bloom filternumFuncs
- - number of hash functionspublic void add(byte[] val)
public void addBytes(byte[] val, int offset, int length)
public void addString(String val)
public void addLong(long val)
public void addDouble(double val)
public boolean test(byte[] val)
public boolean testBytes(byte[] val, int offset, int length)
public boolean testString(String val)
public boolean testLong(long val)
public boolean testDouble(double val)
public long sizeInBytes()
public int getBitSize()
public int getNumHashFunctions()
public long[] getBitSet()
public void merge(BloomFilter that)
that
- - bloom filter to mergepublic void reset()
public static void serialize(OutputStream out, BloomFilter bloomFilter) throws IOException
out
- output stream to write tobloomFilter
- BloomFilter that needs to be seralizedIOException
public static BloomFilter deserialize(InputStream in) throws IOException
BloomFilter
in
- input bytestreamIOException
public static void mergeBloomFilterBytes(byte[] bf1Bytes, int bf1Start, int bf1Length, byte[] bf2Bytes, int bf2Start, int bf2Length)
bf1Bytes
- bf1Start
- bf1Length
- bf2Bytes
- bf2Start
- bf2Length
- Copyright © 2021 The Apache Software Foundation. All rights reserved.