@Override public void readFields(DataInput in) throws IOException { super.readFields(in); createVector(); for (int i = 0; i < fpVector.length; i++) { List<Key> list = fpVector[i]; int size = in.readInt(); for (int j = 0; j < size; j++) { Key k = new Key(); k.readFields(in); list.add(k); } } for (int i = 0; i < keyVector.length; i++) { List<Key> list = keyVector[i]; int size = in.readInt(); for (int j = 0; j < size; j++) { Key k = new Key(); k.readFields(in); list.add(k); } } for (int i = 0; i < ratio.length; i++) { ratio[i] = in.readDouble(); } } }
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) { // TODO Auto-generated catch block e.printStackTrace(); } **/ } return true; }
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); } }
@Override public Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); keyData = new byte[row.length()]; System.arraycopy(row.getBackingArray(), 0, keyData, 0, row.length()); return new Key(keyData, 1.0); }
@Override public Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); ByteSequence cf = acuKey.getColumnFamilyData(); keyData = new byte[row.length() + cf.length()]; System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length()); System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length()); return new Key(keyData, 1.0); }
@Override public org.apache.hadoop.util.bloom.Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); ByteSequence cf = acuKey.getColumnFamilyData(); ByteSequence cq = acuKey.getColumnQualifierData(); keyData = new byte[row.length() + cf.length() + cq.length()]; System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length()); System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length()); System.arraycopy(cq.getBackingArray(), cq.offset(), keyData, row.length() + cf.length(), cq.length()); return new org.apache.hadoop.util.bloom.Key(keyData, 1.0); }
@Override protected void map(Text key, Text value, Context context) throws IOException, InterruptedException { System.out.println("K[" + key + "]"); if(filter.membershipTest(new Key(key.toString().getBytes()))) { context.write(key, value); } } }
public void removeFromBloomFilters(Object[] obj) { for (int i = 0; i < attributeList.size(); i++) { if (obj[i] != null) { bloomFilters[i].delete(new Key(obj[i].toString().getBytes())); } } }
public void add(String key) { if (key == null) { throw new NullPointerException("Key cannot by null"); } filter.add(new Key(key.getBytes(StandardCharsets.UTF_8))); }
public boolean mightContain(String key) { if (key == null) { throw new NullPointerException("Key cannot by null"); } return filter.membershipTest(new Key(key.getBytes(StandardCharsets.UTF_8))); }
@Override public void init() { this.filter = BloomFilterUtils.newDynamicBloomFilter(); this.key = new Key(); }
@Override public void map(Text key, Text value, OutputCollector<NullWritable, BloomFilter> output, Reporter reporter) throws IOException { System.out.println("K[" + key + "]"); int age = Integer.valueOf(value.toString()); if (age > 30) { filter.add(new Key(key.toString().getBytes())); } collector = output; }
public void addUriToBloomFilter(String id, String uri) { KR2RMLBloomFilter bf = null; if(!idToBloomFilter.containsKey(id)) { idToBloomFilter.putIfAbsent(id, new KR2RMLBloomFilter(KR2RMLBloomFilter.defaultVectorSize, KR2RMLBloomFilter.defaultnbHash, Hash.JENKINS_HASH)); } bf = idToBloomFilter.get(id); Key k = new Key(uri.getBytes(UTF8_CHARSET)); bf.add(k); return; }
@Override public void process(K input, Emitter<BloomFilter> emitter) { bloomFilter.add(new Key(keyToBytesFn.map(input))); }
@Override public Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); keyData = new byte[row.length()]; System.arraycopy(row.getBackingArray(), 0, keyData, 0, row.length()); return new Key(keyData, 1.0); }
private void addToBloomFilter(final Object vertex, final BloomFilter filter) throws RetrieverException { try { filter.add(new org.apache.hadoop.util.bloom.Key(elementConverter.serialiseVertex(vertex))); } catch (final AccumuloElementConversionException e) { throw new RetrieverException("Failed to add identifier to the bloom key", e); } }
/** * Transforms an Accumulo {@link org.apache.accumulo.core.data.Key} into the * corresponding key for the Bloom filter. If the key does not correspond to * either an {@link uk.gov.gchq.gaffer.data.element.Entity} or an * {@link uk.gov.gchq.gaffer.data.element.Edge} then an {@link java.io.IOException} will * be thrown by the method which will be caught and then {@code null} * is returned. */ @Override public org.apache.hadoop.util.bloom.Key transform(final Key key) { return new org.apache.hadoop.util.bloom.Key(getVertexFromRangeKey(key.getRowData().getBackingArray())); }
@Override public boolean accept(Pair<K, V> input) { Key key = new Key(keyToBytesFn.map(input.first())); return bloomFilter.membershipTest(key); } }
private void checkSetOnIAE() { Key key = new Key(); try { key.set(null, 0); } catch (IllegalArgumentException ex) { // expected } catch (Exception e) { Assert.fail("checkSetOnIAE ex error"); } }
@Override public Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); ByteSequence cf = acuKey.getColumnFamilyData(); keyData = new byte[row.length() + cf.length()]; System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length()); System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length()); return new Key(keyData, 1.0); }