public int tryStoreKey(HiveKey key, boolean partColsIsNull) throws HiveException, IOException {
    if (!isEnabled) {
      return FORWARD; // short-circuit quickly - forward all rows
    }
    if (topN == 0) {
      return EXCLUDE; // short-circuit quickly - eat all rows
    }
    int index = insertKeyIntoHeap(key);
    if (index >= 0) {
      usage += key.getLength();
      return index;
    }
    // IndexStore is trying to tell us something.
    switch (index) {
      case FORWARD:  return FORWARD;
      case EXCLUDE: return EXCLUDE; // skip the row.
      default: {
        assert false;
        throw new HiveException("Invalid result trying to store the key: " + index);
      }
    }
  }
Try store the non-vectorized key.
@param key Serialized key.
@return TopNHash.FORWARD if the row should be forwarded;
        TopNHash.EXCLUDED if the row should be discarded;
        any other number if the row is to be stored; the index should be passed to storeValue.
ql/src/java/org/apache/hadoop/hive/ql/exec/TopNHash.java