use of org.apache.hadoop.hive.metastore.api.PartitionSpecWithSharedSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecBothTypeSet.
@Test
public void testAddPartitionSpecBothTypeSet() throws Exception {
Table table = createTable();
Partition partition = buildPartition(Lists.newArrayList("2013"), getYearPartCol(), 1);
PartitionWithoutSD partitionWithoutSD = buildPartitionWithoutSD(Lists.newArrayList("2014"), 0);
PartitionSpec partitionSpec = new PartitionSpec();
partitionSpec.setDbName(DB_NAME);
partitionSpec.setTableName(TABLE_NAME);
PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec();
partitionListComposingSpec.setPartitions(Lists.newArrayList(partition));
partitionSpec.setPartitionList(partitionListComposingSpec);
PartitionSpecWithSharedSD partitionSpecWithSharedSD = new PartitionSpecWithSharedSD();
partitionSpecWithSharedSD.setPartitions(Lists.newArrayList(partitionWithoutSD));
partitionSpecWithSharedSD.setSd(buildSD(table.getSd().getLocation() + "/sharedSDTest/"));
partitionSpec.setSharedSDPartitionSpec(partitionSpecWithSharedSD);
PartitionSpecProxy partitionSpecProxy = PartitionSpecProxy.Factory.get(partitionSpec);
client.add_partitions_pspec(partitionSpecProxy);
List<String> partitionNames = client.listPartitionNames(DB_NAME, TABLE_NAME, MAX);
Assert.assertNotNull(partitionNames);
Assert.assertTrue(partitionNames.size() == 1);
Assert.assertEquals("year=2013", partitionNames.get(0));
}
use of org.apache.hadoop.hive.metastore.api.PartitionSpecWithSharedSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method buildPartitionSpecWithSharedSD.
private PartitionSpecProxy buildPartitionSpecWithSharedSD(List<PartitionWithoutSD> partitions, StorageDescriptor sd) {
PartitionSpec partitionSpec = new PartitionSpec();
partitionSpec.setDbName(DB_NAME);
partitionSpec.setTableName(TABLE_NAME);
PartitionSpecWithSharedSD partitionList = new PartitionSpecWithSharedSD();
partitionList.setPartitions(partitions);
partitionList.setSd(sd);
partitionSpec.setSharedSDPartitionSpec(partitionList);
return PartitionSpecProxy.Factory.get(partitionSpec);
}
use of org.apache.hadoop.hive.metastore.api.PartitionSpecWithSharedSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method buildPartitionSpec.
private PartitionSpecProxy buildPartitionSpec(List<Partition> partitions, List<PartitionWithoutSD> partitionsWithoutSD) throws MetaException {
List<PartitionSpec> partitionSpecs = new ArrayList<>();
PartitionSpec partitionSpec = new PartitionSpec();
partitionSpec.setDbName(DB_NAME);
partitionSpec.setTableName(TABLE_NAME);
PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec();
partitionListComposingSpec.setPartitions(partitions);
partitionSpec.setPartitionList(partitionListComposingSpec);
PartitionSpec partitionSpecSharedSD = new PartitionSpec();
partitionSpecSharedSD.setDbName(DB_NAME);
partitionSpecSharedSD.setTableName(TABLE_NAME);
PartitionSpecWithSharedSD partitionSpecWithSharedSD = new PartitionSpecWithSharedSD();
partitionSpecWithSharedSD.setPartitions(partitionsWithoutSD);
partitionSpecWithSharedSD.setSd(buildSD(metaStore.getWarehouseRoot() + "/" + TABLE_NAME + "/sharedSDTest/"));
partitionSpecSharedSD.setSharedSDPartitionSpec(partitionSpecWithSharedSD);
partitionSpecs.add(partitionSpec);
partitionSpecs.add(partitionSpecSharedSD);
return PartitionSpecProxy.Factory.get(partitionSpecs);
}
Aggregations