code: public static String getPartitionSpecString(Map<String, String> spec) {
      StringBuilder sb = new StringBuilder();
      for (Map.Entry<String, String> entry : spec.entrySet()) {
        if (!sb.toString().isEmpty()) {
          sb.append(",");
        }
        sb.append(entry.getKey());
        sb.append("=");
        sb.append(getQuotedString(entry.getValue()));
      }
      return sb.toString();
    }
docs: This method returns the partition spec string of the partition.
  Example : datepartition='2016-01-01-00', size='12345'