public int computePrimaryKeyHashValue(ITupleReference tuple, int[] primaryKeyFields) { MurmurHash128Bit.hash3_x64_128(tuple, primaryKeyFields, SEED, longHashes); return Math.abs((int) longHashes[0]); }
k1 = rotl64(k1, 31); k1 *= c2; h1 ^= k1; h1 = rotl64(h1, 27); h1 += h2; h1 = h1 * 5 + 0x52dce729; k2 = rotl64(k2, 33); k2 *= c1; h2 ^= k2; h2 = rotl64(h2, 31); h2 += h1; h2 = h2 * 5 + 0x38495ab5; k2 = rotl64(k2, 33); k2 *= c1; h2 ^= k2; + bytePos]); k1 *= c1; k1 = rotl64(k1, 31); k1 *= c2; h1 ^= k1; h1 = fmix(h1); h2 = fmix(h2);
protected int computePrimaryKeyHashValue(ITupleReference tuple, int[] primaryKeyFields) { MurmurHash128Bit.hash3_x64_128(tuple, primaryKeyFields, SEED, longHashes); return Math.abs((int) longHashes[0]); }
public boolean contains(ITupleReference tuple, long[] hashes) throws HyracksDataException { if (numPages == 0) { return false; } MurmurHash128Bit.hash3_x64_128(tuple, keyFields, SEED, hashes); if (version == BLOCKED_BLOOM_FILTER_VERSION) { return blockContains(hashes); } else { return legacyContains(hashes); } }
@Override public void add(ITupleReference tuple) throws HyracksDataException { if (numPages == 0) { throw HyracksDataException.create(ErrorCode.CANNOT_ADD_TUPLES_TO_DUMMY_BLOOM_FILTER); } actualNumElements++; MurmurHash128Bit.hash3_x64_128(tuple, keyFields, SEED, hashes); long hash = Math.abs(hashes[0] % numBits); long groupId = hash / NUM_BITS_PER_BLOCK; int pageId = (int) (groupId / numBlocksPerPage); long groupStartIndex = (groupId % numBlocksPerPage) * NUM_BITS_PER_BLOCK; ICachedPage page = pages[pageId]; ByteBuffer buffer = page.getBuffer(); for (int i = 1; i < numHashes; ++i) { hash = Math.abs((hashes[0] + i * hashes[1]) % NUM_BITS_PER_BLOCK); int byteIndex = (int) ((hash + groupStartIndex) >> 3); // divide 8 byte b = buffer.get(byteIndex); int bitIndex = (int) (hash & 0x07); // mod 8 b = (byte) (b | (1 << bitIndex)); buffer.put(byteIndex, b); } }