/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
/** * Checks if this MapFile has the indicated key. The membership test is * performed using a Bloom filter, so the result has always non-zero * probability of false positives. * @param key key to check * @return false iff key doesn't exist, true if key probably exists. * @throws IOException */ public boolean probablyHasKey(WritableComparable key) throws IOException { if (bloomFilter == null) { return true; } buf.reset(); key.write(buf); bloomKey.set(byteArrayForBloomKey(buf), 1.0); return bloomFilter.membershipTest(bloomKey); }
@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); }
/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
/** * Constructor. * <p> * Builds a key with a specified weight. * @param value The value of <i>this</i> key. * @param weight The weight associated to <i>this</i> key. */ public Key(byte[] value, double weight) { set(value, weight); }
@Nullable public Boolean evaluate(@Nullable Text bloomStr, @Nullable Text keyStr) throws HiveException { if (bloomStr == null) { return null; } if (keyStr == null) { return Boolean.FALSE; } Filter bloom = getFilter(bloomStr); key.set(keyStr.copyBytes(), 1.0d); return Boolean.valueOf(bloom.membershipTest(key)); }
public boolean iterate(@Nullable Text keyStr) { if (keyStr == null) { return true; } if (filter == null) { init(); } key.set(keyStr.copyBytes(), 1.0d); filter.add(key); return true; }
@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); }
/** * Checks if this MapFile has the indicated key. The membership test is * performed using a Bloom filter, so the result has always non-zero * probability of false positives. * @param key key to check * @return false iff key doesn't exist, true if key probably exists. * @throws IOException */ public boolean probablyHasKey(WritableComparable key) throws IOException { if (bloomFilter == null) { return true; } buf.reset(); key.write(buf); bloomKey.set(byteArrayForBloomKey(buf), 1.0); return bloomFilter.membershipTest(bloomKey); }
/** * Checks if this MapFile has the indicated key. The membership test is * performed using a Bloom filter, so the result has always non-zero * probability of false positives. * @param key key to check * @return false iff key doesn't exist, true if key probably exists. * @throws IOException */ public boolean probablyHasKey(WritableComparable key) throws IOException { if (bloomFilter == null) { return true; } buf.reset(); key.write(buf); bloomKey.set(byteArrayForBloomKey(buf), 1.0); return bloomFilter.membershipTest(bloomKey); }
@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); }
/** * Checks if this MapFile has the indicated key. The membership test is * performed using a Bloom filter, so the result has always non-zero * probability of false positives. * @param key key to check * @return false iff key doesn't exist, true if key probably exists. * @throws IOException */ public boolean probablyHasKey(WritableComparable key) throws IOException { if (bloomFilter == null) { return true; } buf.reset(); key.write(buf); bloomKey.set(byteArrayForBloomKey(buf), 1.0); return bloomFilter.membershipTest(bloomKey); }
@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); }
@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); }
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 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); }
private void checkSetOnIAE() { Key key = new Key(); try { key.set(null, 0); } catch (IllegalArgumentException ex) { // expected } catch (Exception e) { Assert.fail("checkSetOnIAE ex error"); } }