public static String partitionNameToDdlSpec(String partitionName){
  String[] partitionNameSplit=partitionName.split("/");
  List<String> columnExpressions=new ArrayList<>();
  for (  String columnValue : partitionNameSplit) {
    String[] columnValueSplit=columnValue.split("=");
    if (columnValueSplit.length != 2) {
      throw new RuntimeException("Invalid partition name " + partitionName);
    }
    columnExpressions.add(columnValueSplit[0] + "='" + columnValueSplit[1]+ "'");
  }
  return "PARTITION(" + StringUtils.join(columnExpressions,", ") + ")";
}

public static String partitionNameToDdlSpec ( String partitionName ) { String [ ] partitionNameSplit = partitionName . split ( "/" ) ; List < String > columnExpressions = new ArrayList < > ( ) ; for ( String columnValue : partitionNameSplit ) { String [ ] columnValueSplit = columnValue . split ( "=" ) ; if ( columnValueSplit . length != 2 ) { throw new RuntimeException ( "Invalid partition name " + partitionName ) ; } columnExpressions . add ( columnValueSplit [ 0 ] + "='" + columnValueSplit [ 1 ] + "'" ) ; } return "PARTITION(" + StringUtils . join ( columnExpressions , ", " ) + ")" ; }
converts a partition name into a spec used for ddl commands . for example , ds = 1 / hr = 2 - > partition ( ds = ' 1 ' , hr = ' 2 ' ) . note the special characters are not escapsed as they are in production .
