public class BloomFilter extends Object
Internally, this implementation of bloom filter uses MemorySegment to store BitSet, BloomFilter and BitSet are designed to be able to switch between different MemorySegments, so that Flink can share the same BloomFilter/BitSet object instance for different bloom filters.
Part of this class refers to the implementation from Apache Hive project https://github.com/apache/hive/blob/master/common/src/java/org/apache/hive/common/util/BloomFilter.java
| 限定符和类型 | 字段和说明 |
|---|---|
protected BitSet |
bitSet |
protected int |
expectedEntries |
protected int |
numHashFunctions |
| 构造器和说明 |
|---|
BloomFilter(int expectedEntries,
int byteSize) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHash(int hash32) |
static double |
estimateFalsePositiveProbability(long inputEntries,
int bitSize)
Compute the false positive probability based on given input entries and bits size.
|
static int |
optimalNumOfBits(long inputEntries,
double fpp)
Compute optimal bits number with given input entries and expected false positive probability.
|
void |
reset() |
void |
setBitsLocation(org.apache.flink.core.memory.MemorySegment memorySegment,
int offset) |
boolean |
testHash(int hash32) |
String |
toString() |
protected BitSet bitSet
protected int expectedEntries
protected int numHashFunctions
public void setBitsLocation(org.apache.flink.core.memory.MemorySegment memorySegment,
int offset)
public static int optimalNumOfBits(long inputEntries,
double fpp)
inputEntries - fpp - public static double estimateFalsePositiveProbability(long inputEntries,
int bitSize)
inputEntries - bitSize - public void addHash(int hash32)
public boolean testHash(int hash32)
public void reset()
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.