Index: webhcat/java-client/src/test/java/org/apache/hcatalog/api/TestHCatClient.java =================================================================== --- webhcat/java-client/src/test/java/org/apache/hcatalog/api/TestHCatClient.java (revision 1421057) +++ webhcat/java-client/src/test/java/org/apache/hcatalog/api/TestHCatClient.java (working copy) @@ -203,7 +203,7 @@ Map thirdPtn = new HashMap(); thirdPtn.put("dt", "04/13/2012"); - thirdPtn.put("country", "argetina"); + thirdPtn.put("country", "argentina"); HCatAddPartitionDesc addPtn3 = HCatAddPartitionDesc.create(dbName, tableName, null, thirdPtn).build(); client.addPartition(addPtn3); @@ -221,7 +221,7 @@ assertTrue(ptnList.size() == 2); List ptnListTwo = client.listPartitionsByFilter(dbName, - tableName, "country = \"argetina\""); + tableName, "country = \"argentina\""); assertTrue(ptnListTwo.size() == 1); client.markPartitionForEvent(dbName, tableName, thirdPtn, @@ -501,4 +501,35 @@ assertTrue("Unexpected exception:" + exception.getMessage(), false); } } + + @Test + public void testPartitionSchema() throws Exception { + try { + HCatClient client = HCatClient.create(new Configuration(hcatConf)); + final String dbName = "myDb"; + final String tableName = "myTable"; + + client.dropDatabase(dbName, true, HCatClient.DropDBMode.CASCADE); + + client.createDatabase(HCatCreateDBDesc.create(dbName).build()); + List columnSchema = Arrays.asList(new HCatFieldSchema("foo", Type.INT, ""), + new HCatFieldSchema("bar", Type.STRING, "")); + + List partitionSchema = Arrays.asList(new HCatFieldSchema("dt", Type.STRING, ""), + new HCatFieldSchema("grid", Type.STRING, "")); + + client.createTable(HCatCreateTableDesc.create(dbName, tableName, columnSchema).partCols(partitionSchema).build()); + + HCatTable table = client.getTable(dbName, tableName); + List partitionColumns = table.getPartCols(); + + assertArrayEquals("Didn't get expected partition-schema back from the HCatTable.", + partitionSchema.toArray(), partitionColumns.toArray()); + client.dropDatabase(dbName, false, HCatClient.DropDBMode.CASCADE); + } + catch (Exception unexpected) { + LOG.error("Unexpected exception!", unexpected); + assertTrue("Unexpected exception! " + unexpected.getMessage(), false); + } + } } Index: webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatTable.java =================================================================== --- webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatTable.java (revision 1421057) +++ webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatTable.java (working copy) @@ -58,7 +58,7 @@ } partCols = new ArrayList(); for (FieldSchema colFS : hiveTable.getPartitionKeys()) { - cols.add(HCatSchemaUtils.getHCatFieldSchema(colFS)); + partCols.add(HCatSchemaUtils.getHCatFieldSchema(colFS)); } bucketCols = hiveTable.getSd().getBucketCols(); sortCols = hiveTable.getSd().getSortCols(); Index: webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatCreateTableDesc.java =================================================================== --- webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatCreateTableDesc.java (revision 1421057) +++ webhcat/java-client/src/main/java/org/apache/hcatalog/api/HCatCreateTableDesc.java (working copy) @@ -371,7 +371,7 @@ * @param partCols the partition cols * @return the builder */ - public Builder partCols(ArrayList partCols) { + public Builder partCols(List partCols) { this.partCols = partCols; return this; } @@ -383,7 +383,7 @@ * @param bucketCols the bucket cols * @return the builder */ - public Builder bucketCols(ArrayList bucketCols, int buckets) { + public Builder bucketCols(List bucketCols, int buckets) { this.bucketCols = bucketCols; this.numBuckets = buckets; return this;