DynamicBloomFilter
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.hadoop.util.bloom.DynamicBloomFilter(Showing top 15 results out of 315)

  • Common ways to obtain DynamicBloomFilter
private void myMethod () {
DynamicBloomFilter d =
  • new DynamicBloomFilter()
  • Configuration conf;new DynamicBloomFilter(vectorSize, nbHash, Hash.getHashType(conf), nr)
  • Smart code suggestions by Codota
}
origin: com.facebook.presto.hadoop/hadoop-cdh4

@Override
public synchronized void append(WritableComparable key, Writable val)
  throws IOException {
 super.append(key, val);
 buf.reset();
 key.write(buf);
 bloomKey.set(byteArrayForBloomKey(buf), 1.0);
 bloomFilter.add(bloomKey);
}
origin: com.facebook.hadoop/hadoop-core

@Override
public synchronized void close() throws IOException {
 super.close();
 DataOutputStream out = fs.create(new Path(dir, BLOOM_FILE_NAME), true);
 bloomFilter.write(out);
 out.flush();
 out.close();
}
origin: com.facebook.hadoop/hadoop-core

private void initBloomFilter(FileSystem fs, String dirName,
  Configuration conf) {
 try {
  DataInputStream in = fs.open(new Path(dirName, BLOOM_FILE_NAME));
  bloomFilter = new DynamicBloomFilter();
  bloomFilter.readFields(in);
  in.close();
 } catch (IOException ioe) {
  LOG.warn("Can't open BloomFilter: " + ioe + " - fallback to MapFile.");
  bloomFilter = null;
 }
}

origin: com.facebook.hadoop/hadoop-core

private synchronized void initBloomFilter(Configuration conf) {
 numKeys = conf.getInt("io.mapfile.bloom.size", 1024 * 1024);
 // vector size should be <code>-kn / (ln(1 - c^(1/k)))</code> bits for
 // single key, where <code> is the number of hash functions,
 // <code>n</code> is the number of keys and <code>c</code> is the desired
 // max. error rate.
 // Our desired error rate is by default 0.005, i.e. 0.5%
 float errorRate = conf.getFloat("io.mapfile.bloom.error.rate", 0.005f);
 vectorSize = (int)Math.ceil((double)(-HASH_COUNT * numKeys) /
   Math.log(1.0 - Math.pow(errorRate, 1.0/HASH_COUNT)));
 bloomFilter = new DynamicBloomFilter(vectorSize, HASH_COUNT,
   Hash.getHashType(conf), numKeys);
}
origin: io.hops/hadoop-common

@Override
public void add(Key key) {
 if (key == null) {
  throw new NullPointerException("Key can not be null");
 }
 BloomFilter bf = getActiveStandardBF();
 if (bf == null) {
  addRow();
  bf = matrix[matrix.length - 1];
  currentNbRecord = 0;
 }
 bf.add(key);
 currentNbRecord++;
}
origin: com.facebook.presto.hadoop/hadoop-cdh4

private void initBloomFilter(Path dirName, 
               Configuration conf) {
 
 DataInputStream in = null;
 try {
  FileSystem fs = dirName.getFileSystem(conf);
  in = fs.open(new Path(dirName, BLOOM_FILE_NAME));
  bloomFilter = new DynamicBloomFilter();
  bloomFilter.readFields(in);
  in.close();
  in = null;
 } catch (IOException ioe) {
  LOG.warn("Can't open BloomFilter: " + ioe + " - fallback to MapFile.");
  bloomFilter = null;
 } finally {
  IOUtils.closeStream(in);
 }
}

origin: io.hops/hadoop-common

@Test
public void testDynamicBloomFilter() {
 int hashId = Hash.JENKINS_HASH;    
 Filter filter = new DynamicBloomFilter(bitSize, hashFunctionNumber,
   Hash.JENKINS_HASH, 3);    
 BloomFilterCommonTester.of(hashId, numInsertions)
   .withFilterInstance(filter)
   .withTestCases(ImmutableSet.of(BloomFilterTestStrategy.KEY_TEST_STRATEGY,
       BloomFilterTestStrategy.ADD_KEYS_STRATEGY,
       BloomFilterTestStrategy.EXCEPTIONS_CHECK_STRATEGY,
       BloomFilterTestStrategy.WRITE_READ_STRATEGY,
       BloomFilterTestStrategy.ODD_EVEN_ABSENT_STRATEGY))
       .test();
 
 assertNotNull("testDynamicBloomFilter error ", filter.toString());
}
origin: com.facebook.hadoop/hadoop-core

@Override
public synchronized void append(WritableComparable key, Writable val)
  throws IOException {
 super.append(key, val);
 buf.reset();
 key.write(buf);
 bloomKey.set(buf.getData(), 1.0);
 bloomFilter.add(bloomKey);
}
origin: com.facebook.presto.hadoop/hadoop-cdh4

@Override
public synchronized void close() throws IOException {
 super.close();
 DataOutputStream out = fs.create(new Path(dir, BLOOM_FILE_NAME), true);
 try {
  bloomFilter.write(out);
  out.flush();
  out.close();
  out = null;
 } finally {
  IOUtils.closeStream(out);
 }
}
origin: io.hops/hadoop-common

@Override
public synchronized void append(WritableComparable key, Writable val)
  throws IOException {
 super.append(key, val);
 buf.reset();
 key.write(buf);
 bloomKey.set(byteArrayForBloomKey(buf), 1.0);
 bloomFilter.add(bloomKey);
}
origin: com.facebook.presto.hadoop/hadoop-cdh4

private synchronized void initBloomFilter(Configuration conf) {
 numKeys = conf.getInt("io.mapfile.bloom.size", 1024 * 1024);
 // vector size should be <code>-kn / (ln(1 - c^(1/k)))</code> bits for
 // single key, where <code> is the number of hash functions,
 // <code>n</code> is the number of keys and <code>c</code> is the desired
 // max. error rate.
 // Our desired error rate is by default 0.005, i.e. 0.5%
 float errorRate = conf.getFloat("io.mapfile.bloom.error.rate", 0.005f);
 vectorSize = (int)Math.ceil((double)(-HASH_COUNT * numKeys) /
   Math.log(1.0 - Math.pow(errorRate, 1.0/HASH_COUNT)));
 bloomFilter = new DynamicBloomFilter(vectorSize, HASH_COUNT,
   Hash.getHashType(conf), numKeys);
}
origin: io.hops/hadoop-common

@Override
public synchronized void close() throws IOException {
 super.close();
 DataOutputStream out = fs.create(new Path(dir, BLOOM_FILE_NAME), true);
 try {
  bloomFilter.write(out);
  out.flush();
  out.close();
  out = null;
 } finally {
  IOUtils.closeStream(out);
 }
}
origin: com.facebook.hadoop/hadoop-core

@Override
public void add(Key key) {
 if (key == null) {
  throw new NullPointerException("Key can not be null");
 }
 BloomFilter bf = getActiveStandardBF();
 if (bf == null) {
  addRow();
  bf = matrix[matrix.length - 1];
  currentNbRecord = 0;
 }
 bf.add(key);
 currentNbRecord++;
}
origin: com.facebook.presto.hadoop/hadoop-cdh4

@Override
public void add(Key key) {
 if (key == null) {
  throw new NullPointerException("Key can not be null");
 }
 BloomFilter bf = getActiveStandardBF();
 if (bf == null) {
  addRow();
  bf = matrix[matrix.length - 1];
  currentNbRecord = 0;
 }
 bf.add(key);
 currentNbRecord++;
}
origin: io.hops/hadoop-common

private synchronized void initBloomFilter(Configuration conf) {
 numKeys = conf.getInt(
   IO_MAPFILE_BLOOM_SIZE_KEY, IO_MAPFILE_BLOOM_SIZE_DEFAULT);
 // vector size should be <code>-kn / (ln(1 - c^(1/k)))</code> bits for
 // single key, where <code> is the number of hash functions,
 // <code>n</code> is the number of keys and <code>c</code> is the desired
 // max. error rate.
 // Our desired error rate is by default 0.005, i.e. 0.5%
 float errorRate = conf.getFloat(
   IO_MAPFILE_BLOOM_ERROR_RATE_KEY, IO_MAPFILE_BLOOM_ERROR_RATE_DEFAULT);
 vectorSize = (int)Math.ceil((double)(-HASH_COUNT * numKeys) /
   Math.log(1.0 - Math.pow(errorRate, 1.0/HASH_COUNT)));
 bloomFilter = new DynamicBloomFilter(vectorSize, HASH_COUNT,
   Hash.getHashType(conf), numKeys);
}
org.apache.hadoop.util.bloomDynamicBloomFilter

Javadoc

Implements a dynamic Bloom filter, as defined in the INFOCOM 2006 paper.

A dynamic Bloom filter (DBF) makes use of a s * m bit matrix but each of the s rows is a standard Bloom filter. The creation process of a DBF is iterative. At the start, the DBF is a 1 * m bit matrix, i.e., it is composed of a single standard Bloom filter. It assumes that nr elements are recorded in the initial bit vector, where nr (n is the cardinality of the set A to record in the filter).

As the size of A grows during the execution of the application, several keys must be inserted in the DBF. When inserting a key into the DBF, one must first get an active Bloom filter in the matrix. A Bloom filter is active when the number of recorded keys, nr, is strictly less than the current cardinality of A, n. If an active Bloom filter is found, the key is inserted and nr is incremented by one. On the other hand, if there is no active Bloom filter, a new one is created (i.e., a new row is added to the matrix) according to the current size of A and the element is added in this new Bloom filter and the nr value of this new Bloom filter is set to one. A given key is said to belong to the DBF if the k positions are set to one in one of the matrix rows.

Originally created by European Commission One-Lab Project 034819.

Most used methods

  • <init>
    Constructor. Builds an empty Dynamic Bloom filter.
  • add
  • addRow
    Adds a new row to this dynamic Bloom filter.
  • getActiveStandardBF
    Returns the active standard Bloom filter in this dynamic Bloom filter.
  • membershipTest
  • readFields
  • write

Popular classes and methods

  • compareTo (BigDecimal)
    Compares this BigDecimal with val. Returns one of the three values 1, 0, or -1. The method behaves a
  • getApplicationContext (Context)
  • getOriginalFilename (MultipartFile)
  • GridBagLayout (java.awt)
  • Window (java.awt)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • SortedMap (java.util)
    A Map that further provides a total ordering on its keys. The map is ordered according to the Compar
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)