public static int calculateHashCode(long refWord, WriteBuffers writeBuffers,
      WriteBuffers.Position readPos) {

    // Preconditions.checkState((refWord & KeyRef.IsInvalidFlag.flagOnMask) == 0);

    final long absoluteOffset = KeyRef.getAbsoluteOffset(refWord);

    int actualKeyLength = KeyRef.getSmallKeyLength(refWord);
    boolean isKeyLengthSmall = (actualKeyLength != KeyRef.SmallKeyLength.allBitsOn);
    final long keyAbsoluteOffset;
    if (!isKeyLengthSmall) {

      // Position after next relative offset (fixed length) to the key.
      writeBuffers.setReadPoint(absoluteOffset, readPos);

      // And, if current value is big we must read it.
      actualKeyLength = writeBuffers.readVInt(readPos);

      // Now the read position is set to start of the key as readVInt moved the
      // position by size of key length.
      return writeBuffers.hashCode(actualKeyLength, readPos);
    } else {
      keyAbsoluteOffset = absoluteOffset;
      return writeBuffers.unsafeHashCode(keyAbsoluteOffset, actualKeyLength);
    }
  }
This method calculates the hash code of the key referred by the refWord. The refWord has the offset of the key
in the writeBuffers. In case of smaller key, of length less than 256 bytes, the length is stored in refWord itself.
For larger keys, the length is stored in the writeBuffers along with the key. The length is stored first followed
by the key. So in case of big key, readPos is used to get the length first. This will set the read position
to the beginning of key. Then writeBuffers.hashCode is used to get the hash code. For smaller keys, unsafeHashCode
is used, which will set the read position to keyAbsoluteOffset.

@param refWord The long value containing the offset of the key in writeBuffers.
@param writeBuffers Buffer used for storing the keys present in the hash table.
@param readPos temporary position to be used in this method.
@return hash code for the key pointed to by refWord
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashKeyRef.java