use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecNullPartList.
@Test(expected = MetaException.class)
public void testAddPartitionSpecNullPartList() throws Exception {
createTable();
List<Partition> partitions = null;
PartitionSpecProxy partitionSpec = buildPartitionSpec(DB_NAME, TABLE_NAME, null, partitions);
client.add_partitions_pspec(partitionSpec);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecNullSd.
@Test(expected = MetaException.class)
public void testAddPartitionSpecNullSd() throws Exception {
createTable();
Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
partition.setSd(null);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, TABLE_NAME, null, Lists.newArrayList(partition));
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecEmptyLocationInTableToo.
@Test
public void testAddPartitionSpecEmptyLocationInTableToo() throws Exception {
Table table = createTable(DB_NAME, TABLE_NAME, getYearPartCol(), null);
Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE, "");
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, TABLE_NAME, null, Lists.newArrayList(partition));
client.add_partitions_pspec(partitionSpecProxy);
Partition resultPart = client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList(DEFAULT_YEAR_VALUE));
Assert.assertEquals(table.getSd().getLocation() + "/year=2017", resultPart.getSd().getLocation());
Assert.assertTrue(metaStore.isPathExists(new Path(resultPart.getSd().getLocation())));
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecNoTable.
@Test(expected = MetaException.class)
public void testAddPartitionSpecNoTable() throws Exception {
createTable();
Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, null, null, Lists.newArrayList(partition));
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecOneInvalid.
@Test
public void testAddPartitionSpecOneInvalid() throws Exception {
createTable();
String tableLocation = metaStore.getWarehouseRoot() + "/" + TABLE_NAME;
Partition partition1 = buildPartition(DB_NAME, TABLE_NAME, "2016", tableLocation + "/year=2016");
Partition partition2 = buildPartition(DB_NAME, TABLE_NAME, "2017", tableLocation + "/year=2017");
Partition partition3 = buildPartition(Lists.newArrayList("2015", "march"), getYearAndMonthPartCols(), 1);
partition3.getSd().setLocation(tableLocation + "/year=2015/month=march");
Partition partition4 = buildPartition(DB_NAME, TABLE_NAME, "2018", tableLocation + "/year=2018");
Partition partition5 = buildPartition(DB_NAME, TABLE_NAME, "2019", tableLocation + "/year=2019");
List<Partition> partitions = Lists.newArrayList(partition1, partition2, partition3, partition4, partition5);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, TABLE_NAME, null, partitions);
try {
client.add_partitions_pspec(partitionSpecProxy);
Assert.fail("MetaException should have happened.");
} catch (MetaException e) {
// Expected exception
}
List<Partition> parts = client.listPartitions(DB_NAME, TABLE_NAME, MAX);
Assert.assertNotNull(parts);
Assert.assertTrue(parts.isEmpty());
for (Partition part : partitions) {
Assert.assertFalse(metaStore.isPathExists(new Path(part.getSd().getLocation())));
}
}
Aggregations