/** * Murmur3 32-bit variant. * * @param data - input byte array * @return - hashcode */ public static int hash32(byte[] data) { return hash32(data, 0, data.length, DEFAULT_SEED); }
/** * Murmur3 32-bit variant. * * @param data - input byte array * @param length - length of array * @return - hashcode */ public static int hash32(byte[] data, int length) { return hash32(data, 0, length, DEFAULT_SEED); }
/** * Murmur3 32-bit variant. * * @param data - input byte array * @param length - length of array * @param seed - seed. (default 0) * @return - hashcode */ public static int hash32(byte[] data, int length, int seed) { return hash32(data, 0, length, seed); }
public static int calculateTwoLongHashCode(long l0, long l1) { return Murmur3.hash32(l0, l1); }
public static int hash32(long l0, long l1) { return hash32(l0, l1, DEFAULT_SEED); }
public static int calculateLongHashCode(long key) { return Murmur3.hash32(key); }
public static int hash32(long l0) { return hash32(l0, DEFAULT_SEED); }
/** * Batch compute the hash codes for all the serialized keys. * * NOTE: MAJOR MAJOR ASSUMPTION: * We assume that HashCodeUtil.murmurHash produces the same result * as MurmurHash.hash with seed = 0 (the method used by ReduceSinkOperator for * UNIFORM distribution). */ protected void computeSerializedHashCodes() { int offset = 0; int keyLength; byte[] bytes = output.getData(); for (int i = 0; i < nonNullKeyCount; i++) { keyLength = serializedKeyLengths[i]; hashCodes[i] = Murmur3.hash32(bytes, offset, keyLength, 0); offset += keyLength; } }
protected final int computeMurmurHash(HiveKey firstKey) { return Murmur3.hash32(firstKey.getBytes(), firstKey.getDistKeyLength(), 0); }
case SHORT: { byteBuffer.putShort(((ShortObjectInspector) poi).get(o)); return Murmur3.hash32(byteBuffer.array(), 2); return Murmur3.hash32(byteBuffer.array(), 4); return Murmur3.hash32(byteBuffer.array(), 8); return Murmur3.hash32(byteBuffer.array(), 4); return Murmur3.hash32(byteBuffer.array(), 8); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(((BinaryObjectInspector) poi).getPrimitiveWritableObject(o).getBytes()); return Murmur3.hash32(byteBuffer.array(), 4); case TIMESTAMP: { TimestampWritableV2 t = ((TimestampObjectInspector) poi) .getPrimitiveWritableObject(o); return Murmur3.hash32(t.getBytes()); return Murmur3.hash32((((TimestampLocalTZObjectInspector) poi).getPrimitiveWritableObject(o)).getBytes()); case INTERVAL_YEAR_MONTH: byteBuffer.putInt(((HiveIntervalYearMonthObjectInspector) poi)
/** * Murmur3 32-bit variant. * * @param data - input byte array * @param length - length of array * @param seed - seed. (default 0) * @return - hashcode */ public static int hash32(byte[] data, int length, int seed) { return hash32(data, 0, length, seed); }
/** * Murmur3 32-bit variant. * * @param data - input byte array * @param length - length of array * @return - hashcode */ public static int hash32(byte[] data, int length) { return hash32(data, 0, length, DEFAULT_SEED); }
/** * Murmur3 32-bit variant. * * @param data - input byte array * @return - hashcode */ public static int hash32(byte[] data) { return hash32(data, data.length, DEFAULT_SEED); }
/** * Murmur3 32-bit variant. * * @param data - input byte array * @return - hashcode */ public static int hash32(byte[] data) { return hash32(data, 0, data.length, DEFAULT_SEED); }
case SHORT: { byteBuffer.putShort(((ShortObjectInspector) poi).get(o)); return Murmur3.hash32(byteBuffer.array(), 2); return Murmur3.hash32(byteBuffer.array(), 4); return Murmur3.hash32(byteBuffer.array(), 8); return Murmur3.hash32(byteBuffer.array(), 4); return Murmur3.hash32(byteBuffer.array(), 8); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(text.getBytes(), text.getLength()); return Murmur3.hash32(((BinaryObjectInspector) poi).getPrimitiveWritableObject(o).getBytes()); return Murmur3.hash32(byteBuffer.array(), 4); case TIMESTAMP: { TimestampWritableV2 t = ((TimestampObjectInspector) poi) .getPrimitiveWritableObject(o); return Murmur3.hash32(t.getBytes()); return Murmur3.hash32((((TimestampLocalTZObjectInspector) poi).getPrimitiveWritableObject(o)).getBytes()); case INTERVAL_YEAR_MONTH: byteBuffer.putInt(((HiveIntervalYearMonthObjectInspector) poi)