public static String getNormalisedPartitionValue(String partitionValue, String type) {

    if (!NumberUtils.isParsable(partitionValue)) {
      return partitionValue;
    }

    LOG.debug("Converting '" + partitionValue + "' to type: '" + type + "'.");

    if (type.equalsIgnoreCase("tinyint")
    || type.equalsIgnoreCase("smallint")
    || type.equalsIgnoreCase("int")){
      return Integer.toString(Integer.parseInt(partitionValue));
    } else if (type.equalsIgnoreCase("bigint")){
      return Long.toString(Long.parseLong(partitionValue));
    } else if (type.equalsIgnoreCase("float")){
      return Float.toString(Float.parseFloat(partitionValue));
    } else if (type.equalsIgnoreCase("double")){
      return Double.toString(Double.parseDouble(partitionValue));
    } else if (type.startsWith("decimal")){
      // Decimal datatypes are stored like decimal(10,10)
      return new BigDecimal(partitionValue).stripTrailingZeros().toPlainString();
    }
    return partitionValue;
  }
Get the partition name from the path.

@param tablePath
         Path of the table.
@param partitionPath
         Path of the partition.
@param partCols
         Set of partition columns from table definition
@return Partition name, for example partitiondate=2008-01-01
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java