public static CacheTag getDbAndTableNameForMetrics(Path path, boolean includeParts,
      PartitionDesc part) {

    // Fallback to legacy cache tag creation logic.
    if (part == null) {
      return CacheTag.build(LlapUtil.getDbAndTableNameForMetrics(path, includeParts));
    }

    if (!includeParts || !part.isPartitioned()) {
      return CacheTag.build(part.getTableName());
    } else {
      return CacheTag.build(part.getTableName(), part.getPartSpec());
    }
  }
Takes a Path and looks up the PartitionDesc instance associated with it in a map of Path-&gt;PartitionDesc entries.
If it is not found (e.g. Path denotes a partition path, but map contains table level instances only) we will try
to do the same with the parent of this path, traversing up until there's a match, if any.
@param path the absolute path used for the look up
@param partitionDescMap the map
@return the PartitionDesc instance if found, null if not found
ql/src/java/org/apache/hadoop/hive/llap/LlapHiveUtils.java