@Override public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = (int)(this.weight - other.weight); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
@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); }
/** * Checks if this {@link RFile} contains keys from this range. The membership test is performed * using a Bloom filter, so the result has always non-zero probability of false positives. * * @param range * range of keys to check * @return false iff key doesn't exist, true if key probably exists. */ boolean probablyHasKey(Range range) { if (bloomFilter == null) { initiateLoad(maxLoadThreads); if (bloomFilter == null) return true; } Key bloomKey = transformer.transform(range); if (bloomKey == null || bloomKey.getBytes().length == 0) return true; return bloomFilter.membershipTest(bloomKey); }
@Override public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = (int)(this.weight - other.weight); } return result; } }
public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = Double.valueOf(this.weight - other.weight).intValue(); } return result; } }
@Override public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = Double.valueOf(this.weight - other.weight).intValue(); } return result; } }
@Override public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = Double.valueOf(this.weight - other.weight).intValue(); } return result; } }
@Override public int compareTo(Key other) { int result = this.bytes.length - other.getBytes().length; for (int i = 0; result == 0 && i < bytes.length; i++) { result = this.bytes[i] - other.bytes[i]; } if (result == 0) { result = Double.valueOf(this.weight - other.weight).intValue(); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
@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); }
/** * Checks if this {@link RFile} contains keys from this range. The membership test is performed * using a Bloom filter, so the result has always non-zero probability of false positives. * * @param range * range of keys to check * @return false iff key doesn't exist, true if key probably exists. */ boolean probablyHasKey(Range range) throws IOException { if (bloomFilter == null) { initiateLoad(maxLoadThreads); if (bloomFilter == null) return true; } Key bloomKey = transformer.transform(range); if (bloomKey == null || bloomKey.getBytes().length == 0) return true; return bloomFilter.membershipTest(bloomKey); }