Package org.apache.hadoop.util.bloom
Class RetouchedBloomFilter
java.lang.Object
org.apache.hadoop.util.bloom.Filter
org.apache.hadoop.util.bloom.BloomFilter
org.apache.hadoop.util.bloom.RetouchedBloomFilter
- All Implemented Interfaces:
Writable,RemoveScheme
Implements a retouched Bloom filter, as defined in the CoNEXT 2006 paper.
It allows the removal of selected false positives at the cost of introducing random false negatives, and with the benefit of eliminating some random false positives at the same time.
Originally created by European Commission One-Lab Project 034819.
-
Field Summary
Fields inherited from class org.apache.hadoop.util.bloom.Filter
hash, hashType, nbHash, vectorSizeFields inherited from interface org.apache.hadoop.util.bloom.RemoveScheme
MAXIMUM_FP, MINIMUM_FN, RANDOM, RATIO -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor - use with readFieldsRetouchedBloomFilter(int vectorSize, int nbHash, int hashType) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a key to this filter.voidaddFalsePositive(Collection<Key> coll) Adds a collection of false positive information to this retouched Bloom filter.voidaddFalsePositive(List<Key> keys) Adds a list of false positive information to this retouched Bloom filter.voidaddFalsePositive(Key key) Adds a false positive information to this retouched Bloom filter.voidaddFalsePositive(Key[] keys) Adds an array of false positive information to this retouched Bloom filter.voidreadFields(DataInput in) Deserialize the fields of this object fromin.voidselectiveClearing(Key k, short scheme) Performs the selective clearing for a given key.voidwrite(DataOutput out) Serialize the fields of this object toout.Methods inherited from class org.apache.hadoop.util.bloom.BloomFilter
and, getVectorSize, membershipTest, not, or, toString, xor
-
Constructor Details
-
RetouchedBloomFilter
public RetouchedBloomFilter()Default constructor - use with readFields -
RetouchedBloomFilter
public RetouchedBloomFilter(int vectorSize, int nbHash, int hashType) Constructor- Parameters:
vectorSize- The vector size of this filter.nbHash- The number of hash function to consider.hashType- type of the hashing function (seeHash).
-
-
Method Details
-
add
Description copied from class:FilterAdds a key to this filter.- Overrides:
addin classBloomFilter- Parameters:
key- The key to add.
-
addFalsePositive
Adds a false positive information to this retouched Bloom filter.Invariant: if the false positive is
null, nothing happens.- Parameters:
key- The false positive key to add.
-
addFalsePositive
Adds a collection of false positive information to this retouched Bloom filter.- Parameters:
coll- The collection of false positive.
-
addFalsePositive
Adds a list of false positive information to this retouched Bloom filter.- Parameters:
keys- The list of false positive.
-
addFalsePositive
Adds an array of false positive information to this retouched Bloom filter.- Parameters:
keys- The array of false positive.
-
selectiveClearing
Performs the selective clearing for a given key.- Parameters:
k- The false positive key to remove from this retouched Bloom filter.scheme- The selective clearing scheme to apply.
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Overrides:
writein classBloomFilter- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Overrides:
readFieldsin classBloomFilter- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-