use of org.apache.hadoop.hive.metastore.api.PartitionWithoutSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSDEmptyLocation.
@Test(expected = MetaException.class)
public void testAddPartitionSpecWithSharedSDEmptyLocation() throws Exception {
createTable();
PartitionWithoutSD partition = buildPartitionWithoutSD(Lists.newArrayList("2002"), 0);
partition.setRelativePath("year2002");
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), buildSD(""));
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.api.PartitionWithoutSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSDNoValue.
@Test
public void testAddPartitionSpecWithSharedSDNoValue() throws Exception {
Table table = createTable();
PartitionWithoutSD partition = new PartitionWithoutSD();
partition.setRelativePath("addpartspectest");
String location = table.getSd().getLocation() + "/nullValueTest/";
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), buildSD(location));
try {
client.add_partitions_pspec(partitionSpecProxy);
Assert.fail("Exception should have been thrown.");
} catch (NullPointerException | TTransportException e) {
// TODO: NPE should not be thrown.
}
}
use of org.apache.hadoop.hive.metastore.api.PartitionWithoutSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSDChangeRootPath.
@Test
public void testAddPartitionSpecWithSharedSDChangeRootPath() throws Exception {
Table table = createTable();
String rootPath = table.getSd().getLocation() + "/addPartSpecRootPath/";
String rootPath1 = table.getSd().getLocation() + "/someotherpath/";
PartitionWithoutSD partition = buildPartitionWithoutSD(Lists.newArrayList("2014"), 0);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), buildSD(rootPath));
partitionSpecProxy.setRootLocation(rootPath1);
client.add_partitions_pspec(partitionSpecProxy);
Partition resultPart = client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2014"));
Assert.assertEquals(rootPath1 + "partwithoutsd0", resultPart.getSd().getLocation());
}
use of org.apache.hadoop.hive.metastore.api.PartitionWithoutSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSD.
@Test
public void testAddPartitionSpecWithSharedSD() throws Exception {
Table table = createTable();
PartitionWithoutSD partition1 = buildPartitionWithoutSD(Lists.newArrayList("2013"), 1);
PartitionWithoutSD partition2 = buildPartitionWithoutSD(Lists.newArrayList("2014"), 2);
PartitionWithoutSD partition3 = buildPartitionWithoutSD(Lists.newArrayList("2012"), 3);
List<PartitionWithoutSD> partitions = Lists.newArrayList(partition1, partition2, partition3);
String location = table.getSd().getLocation() + "/sharedSDTest/";
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(partitions, buildSD(location));
client.add_partitions_pspec(partitionSpecProxy);
verifyPartitionSharedSD(table, "year=2013", Lists.newArrayList("2013"), 1);
verifyPartitionSharedSD(table, "year=2014", Lists.newArrayList("2014"), 2);
verifyPartitionSharedSD(table, "year=2012", Lists.newArrayList("2012"), 3);
}
use of org.apache.hadoop.hive.metastore.api.PartitionWithoutSD in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSDNullSd.
@Test
public void testAddPartitionSpecWithSharedSDNullSd() throws Exception {
createTable();
PartitionWithoutSD partition = buildPartitionWithoutSD(Lists.newArrayList("2002"), 0);
StorageDescriptor sd = null;
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), sd);
try {
client.add_partitions_pspec(partitionSpecProxy);
Assert.fail("Exception should have been thrown.");
} catch (NullPointerException | TTransportException e) {
// TODO: NPE should not be thrown.
}
}
Aggregations