private String getFinalDynamicPartitionDestination(Table table, Map<String, String> partKVs,
      OutputJobInfo jobInfo) {
    Path partPath = new Path(table.getTTable().getSd().getLocation());
    if (!customDynamicLocationUsed) {
      // file:///tmp/hcat_junit_warehouse/employee/_DYN0.7770480401313761/emp_country=IN/emp_state=KA  ->
      // file:///tmp/hcat_junit_warehouse/employee/emp_country=IN/emp_state=KA
      for (FieldSchema partKey : table.getPartitionKeys()) {
        partPath = constructPartialPartPath(partPath, partKey.getName().toLowerCase(), partKVs);
      }

      return partPath.toString();
    } else {
      // if custom root specified, update the parent path
      if (jobInfo.getCustomDynamicRoot() != null
          && jobInfo.getCustomDynamicRoot().length() > 0) {
        partPath = new Path(partPath, jobInfo.getCustomDynamicRoot());
      }
      return new Path(partPath, HCatFileUtil.resolveCustomPath(jobInfo, partKVs, false)).toString();
    }
  }
Generate partition metadata object to be used to add to metadata.
@param context The job context.
@param jobInfo The OutputJobInfo.
@param partLocnRoot The table-equivalent location root of the partition
                      (temporary dir if dynamic partition, table dir if static)
@param dynPartPath The path of dynamic partition which is created
@param partKVs The keyvalue pairs that form the partition
@param outputSchema The output schema for the partition
@param params The parameters to store inside the partition
@param table The Table metadata object under which this Partition will reside
@param fs FileSystem object to operate on the underlying filesystem
@param conf HiveConf used to access FS
@param status Permission that's the default permission of the table dir.
@return Constructed Partition metadata object
@throws java.io.IOException
hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/FileOutputCommitterContainer.java