PartitionHelper { public static String buildSuffix(PartitionSpec ps) { if (ps == null) { return ""; } String path = ""; ps.keys().size(); for (String key : ps.keys()) { String val = ps.get(key); val = val.replace(':', ';'); val = val.replace('.', ','); path += '.' + val; } return path; } PartitionHelper(Odps odps, String projectName, String tableName); boolean isPartitioned(); static String buildSuffix(PartitionSpec ps); List<PartitionSpec> completePartitionSpecs(String partitionSpecLiteral); List<PartitionSpec> inferPartitionSpecs(String partitionSpecLiteral);  }
@Test public void testBuildSuffix() throws Exception { PartitionSpec ps = new PartitionSpec("color='red',shape='square',age=12"); assertEquals(".red.square.12", PartitionHelper.buildSuffix(ps)); ps = new PartitionSpec("color='red'"); assertEquals(".red", PartitionHelper.buildSuffix(ps)); ps = new PartitionSpec("color='2:a',key2='3.b'"); assertEquals(".2;a.3,b", PartitionHelper.buildSuffix(ps)); ps = null; assertEquals("", PartitionHelper.buildSuffix(ps)); }