List of usage examples for org.apache.hadoop.util.bloom BloomFilter BloomFilter
public BloomFilter()
From source file:brickhouse.udf.bloom.BloomFactory.java
License:Apache License
static Filter NewVesselBloom() { return new BloomFilter(); }
From source file:com.cloudera.util.bloom.BloomSet.java
License:Apache License
/** * Takes an array of bytes and deserializes it into the current BloomSet. *//*from w w w . j a va 2s. c o m*/ protected BloomFilter deserialize(byte[] serialized) { try { Preconditions.checkArgument(serialized != null); DataInputStream in = new DataInputStream(new ByteArrayInputStream(serialized)); BloomFilter bloom = new BloomFilter(); // empty constructor bloom.readFields(in); return bloom; } catch (IOException e) { throw new IllegalArgumentException(e.getMessage()); } }
From source file:gaffer.accumulostore.key.core.impl.CoreKeyBloomFilterIterator.java
License:Apache License
@Override public boolean validateOptions(final Map<String, String> options) { if (!super.validateOptions(options)) { return false; }// w ww .jav a 2s .c o m if (!options.containsKey(AccumuloStoreConstants.BLOOM_FILTER)) { throw new BloomFilterIteratorException( "Must set the " + AccumuloStoreConstants.BLOOM_FILTER + " option"); } filter = new BloomFilter(); final byte[] bytes; try { bytes = options.get(AccumuloStoreConstants.BLOOM_FILTER) .getBytes(AccumuloStoreConstants.BLOOM_FILTER_CHARSET); } catch (UnsupportedEncodingException e) { throw new BloomFilterIteratorException("Failed to re-create serialised bloom filter", e); } try (final InputStream inStream = new ByteArrayInputStream(bytes); final DataInputStream dataStream = new DataInputStream(inStream)) { filter.readFields(dataStream); } catch (final IOException e) { throw new BloomFilterIteratorException("Failed to re-create serialised bloom filter", e); } return true; }
From source file:gaffer.predicate.typevalue.impl.ValueInBloomFilterPredicate.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { filter = new BloomFilter(); filter.readFields(in); }
From source file:org.apache.pig.builtin.Bloom.java
License:Apache License
private void init() throws IOException { filter = new BloomFilter(); String dcFile = "./" + getFilenameFromPath(bloomFile) + "/part-r-00000"; filter.readFields(new DataInputStream(new FileInputStream(dcFile))); }
From source file:org.apache.pig.builtin.Bloom.java
License:Apache License
/** * For testing only, do not use directly. *//*ww w . ja va 2 s. com*/ public void setFilter(DataByteArray dba) throws IOException { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dba.get())); filter = new BloomFilter(); filter.readFields(dis); }
From source file:org.apache.pig.builtin.BuildBloomBase.java
License:Apache License
protected BloomFilter bloomIn(DataByteArray b) throws IOException { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(b.get())); BloomFilter f = new BloomFilter(); f.readFields(dis);//from ww w .ja va 2 s. com return f; }