Package org.apache.hadoop.util.bloom

Examples of org.apache.hadoop.util.bloom.Key


   
    Filter bloom1 = BloomFactory.NewBloomInstance( numElems, pct);
    for( int i = 0; i< numElems/2; ++i ) {
      UUID uuid  = UUID.randomUUID();
   
      Key key =  new Key(uuid.toString().getBytes() );
      bloom1.add( key );
     
      Assert.assertTrue( bloom1.membershipTest(key));
        (unionMap).add( uuid.toString());
     
      if( (i % 10000) == 0 ) {
          System.out.println(" Added " + i + " elements.");
      }
    }
    Filter bloom2 = BloomFactory.NewBloomInstance( numElems, pct);
   
    for( int i = 0; i< numElems/2; ++i ) {
      UUID uuid  = UUID.randomUUID();
   
      Key key =  new Key(uuid.toString().getBytes() );
      bloom2.add( key );
     
      Assert.assertTrue( bloom2.membershipTest(key));
        (unionMap).add( uuid.toString());
     
      if( (i % 10000) == 0 ) {
          System.out.println(" Added " + i + " elements.");
      }
    }
   
    bloom1.or( bloom2);
   
    for( String uuid : unionMap) {
      Assert.assertTrue( bloom1.membershipTest( new Key(uuid.getBytes())));
    }
 
  }
View Full Code Here


    public boolean iterate( String key) {
      if( key != null) {
        if( bloomFilter == null) {
          init();
        }
        bloomFilter.add( new Key(key.getBytes()));
       
        /**
        try {
        ///LOG.info( "BloomFilter is " + BloomFactory.WriteBloomToString(bloomFilter ) + " after adding Key " +key);
      } catch (IOException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public void aggregate(String data, String metadata) throws IOException, InterruptedException {
    // instantiate a bloom filter input key initialized by the data
    Key key = new Key(data.getBytes());

    // if the key is already in the filter, forget about it
    Filter filter = this.getFilter();
    if (filter.membershipTest(key))
      return;
View Full Code Here


  public Boolean evaluate( String key, String bloomFilter) throws HiveException {
    Filter bloom = BloomFactory.GetBloomFilter(bloomFilter);
    if( bloom != null) {
      return bloom.membershipTest( new Key(key.getBytes()));
    } else {
      throw new HiveException("Unable to find bloom " + bloomFilter);
    }
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public void aggregate(String data, String metadata) throws IOException, InterruptedException {
    // instantiate a bloom filter input key initialized by the data
    Key key = new Key(data.getBytes());

    // if the key is already in the filter, forget it
    if (this.filter.membershipTest(key))
      return;

View Full Code Here

    }
   
    @Override
    public synchronized void append(org.apache.accumulo.core.data.Key key, Value val) throws IOException {
      writer.append(key, val);
      Key bloomKey = transformer.transform(key);
      if (bloomKey.getBytes().length > 0)
        bloomFilter.add(bloomKey);
    }
View Full Code Here

        initiateLoad();
        if (bloomFilter == null)
          return true;
      }
     
      Key bloomKey = transformer.transform(range);
     
      if (bloomKey == null || bloomKey.getBytes().length == 0)
        return true;
     
      return bloomFilter.membershipTest(bloomKey);
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.util.bloom.Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.