public static String makePartNameUtil(Map<String, String> spec, boolean addTrailingSeperator, boolean dynamic)
          throws MetaException {
    StringBuilder suffixBuf = new StringBuilder();
    int i = 0;
    for (Entry<String, String> e : spec.entrySet()) {
      // Throw an exception if it is not a dynamic partition.
      if (e.getValue() == null || e.getValue().length() == 0) {
        if (dynamic) {
          break;
        }
        else {
          throw new MetaException("Partition spec is incorrect. " + spec);
        }
      }

      if (i > 0) {
        suffixBuf.append(Path.SEPARATOR);
      }
      suffixBuf.append(escapePathName(e.getKey()));
      suffixBuf.append('=');
      suffixBuf.append(escapePathName(e.getValue()));
      i++;
    }

    if (addTrailingSeperator && i > 0) {
      suffixBuf.append(Path.SEPARATOR);
    }

    return suffixBuf.toString();
  }
Makes a partition name from a specification
@param spec The partition specification, key and value pairs.
@param addTrailingSeperator If true, adds a trailing separator e.g. 'ds=1/'.
@param dynamic If true, create a dynamic partition name.
@return partition name
@throws MetaException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java