@Override
    public int compareTo(CacheTag o) {
      if (o == null) {
        return 1;
      }
      if (o instanceof TableCacheTag || o instanceof SinglePartitionCacheTag) {
        return 1;
      }
      MultiPartitionCacheTag other = (MultiPartitionCacheTag) o;
      int tableNameDiff = super.compareTo(other);
      if (tableNameDiff != 0) {
        return tableNameDiff;
      } else {
        int sizeDiff = partitionDesc.length - other.partitionDesc.length;
        if (sizeDiff != 0) {
          return sizeDiff;
        } else {
          for (int i = 0; i < partitionDesc.length; ++i) {
            int partDiff = partitionDesc[i].compareTo(other.partitionDesc[i]);
            if (partDiff != 0) {
              return partDiff;
            }
          }
          return 0;
        }
      }
    }
CacheTag for tables with more than one partition level.
storage-api/src/java/org/apache/hadoop/hive/common/io/CacheTag.java