partitionSpec.put(partitionColumn, "foobar"); try { // Test that fetching a non-existent partition yields ObjectNotFound. client.getPartition(dbName, tableName, partitionSpec); assertTrue("Expected ObjectNotFoundException.", false); } catch(Exception exception) { client.getPartition(dbName, tableName, partitionSpec); assertTrue("Expected HCatException.", false); } catch(Exception exception) {
1, sourceMetaStore().getPartitions(dbName, tableName).size()); HCatPartition addedPartition_1 = sourceMetaStore().getPartition(dbName, tableName, partitionSpec_1); assertEquals("Column schema doesn't match.", sourceTable.getCols(), addedPartition_1.getColumns()); assertEquals("InputFormat doesn't match.", sourceTable.getInputFileFormat(), addedPartition_1.getInputFormat());
1, sourceMetaStore().getPartitions(dbName, tableName).size()); HCatPartition addedPartition_1 = sourceMetaStore().getPartition(dbName, tableName, partitionSpec_1); assertEquals("Column schema doesn't match.", sourceTable.getCols(), addedPartition_1.getColumns()); assertEquals("InputFormat doesn't match.", sourceTable.getInputFileFormat(), addedPartition_1.getInputFormat());
client.addPartition(HCatAddPartitionDesc.create(ptnToAdd2).build()); HCatPartition p1 = client.getPartition(dbName,tableName,ptnDesc1); assertNotNull(p1); HCatPartition p2 = client.getPartition(dbName,tableName,ptnDesc2); assertNotNull(p2); assertNotNull(t_stillExists); HCatPartition p2_stillExists = client.getPartition(dbName,tableName,ptnDesc2); HCatPartition p1_del = client.getPartition(dbName,tableName,ptnDesc1); } catch (Exception e) { onfe = e;
assertTrue(ptnList.size() == 3); HCatPartition ptn = client.getPartition(dbName, tableName, firstPtn); assertTrue(ptn != null);
client.addPartition(HCatAddPartitionDesc.create(ptnToAdd).build()); HCatPartition p1 = client.getPartition(dbName,tableName,ptnDesc); assertNotNull(p1); HCatPartition p2 = client.getPartition(dbName,tableName,ptnDesc); assertNotNull(p2); HCatPartition p_del = client.getPartition(dbName,tableName,ptnDesc); } catch (Exception e) { onfe = e; client.addPartition(HCatAddPartitionDesc.create(ptnToAdd2).build()); HCatPartition p3 = client.getPartition(dbName,tableName,ptnDesc); assertNotNull(p3); HCatPartition p_del = client.getPartition(dbName,tableName,ptnDesc); } catch (Exception e) { onfe2 = e;
public void addPartition(String db, String table, String partitionSpec, String location) throws Exception { String[] parts = partitionSpec.split(HCatURI.PARTITION_SEPARATOR); Map<String, String> partitions = new HashMap<String, String>(); for (String part : parts) { String[] split = part.split("="); partitions.put(split[0], split[1]); } HCatAddPartitionDesc addPtn = HCatAddPartitionDesc.create(db, table, location, partitions).build(); hcatClient.addPartition(addPtn); assertNotNull(hcatClient.getPartition(db, table, partitions)); }