@Override
  public long getEstimatedMemorySize() {
    // TODO: Key and Values are Object[] which can be eagerly deserialized or lazily deserialized. To accurately
    // estimate the entry size, every possible Objects in Key, Value should implement MemoryEstimate interface which
    // is very intrusive. So assuming default entry size here.
    return size() * DEFAULT_HASHMAP_ENTRY_SIZE;
  }
Simple wrapper for persistent Hashmap implementing only the put/get/remove/clear interface. The
main memory hash table acts as a cache and all put/get will operate on it first. If the size of
the main memory hash table exceeds a certain threshold, new elements will go into the persistent
hash table.
ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/HashMapWrapper.java