use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecWithSharedSDInvalidSD.
@Test(expected = MetaException.class)
@ConditionalIgnoreOnSessionHiveMetastoreClient
public void testAddPartitionSpecWithSharedSDInvalidSD() throws Exception {
Table table = createTable();
PartitionWithoutSD partition = buildPartitionWithoutSD(Lists.newArrayList("2002"), 0);
partition.setRelativePath("year2002");
StorageDescriptor sd = new StorageDescriptor();
sd.setLocation(table.getSd().getLocation() + "/nullLocationTest/");
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), sd);
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecNullPart.
@Test(expected = MetaException.class)
public void testAddPartitionSpecNullPart() throws Exception {
createTable();
List<Partition> partitions = new ArrayList<>();
Partition partition1 = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
Partition partition2 = null;
partitions.add(partition1);
partitions.add(partition2);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, TABLE_NAME, null, partitions);
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecUpperCaseDBAndTableNameInOnePart.
@Test
@ConditionalIgnoreOnSessionHiveMetastoreClient
public void testAddPartitionSpecUpperCaseDBAndTableNameInOnePart() throws Exception {
String tableName = "test_add_part_table";
String tableLocation = metaStore.getWarehouseRoot() + "/" + tableName.toUpperCase();
createTable(DB_NAME, tableName, getYearPartCol(), tableLocation);
Partition partition1 = buildPartition(DB_NAME, tableName, "2013", tableLocation + "/year=2013");
Partition partition2 = buildPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "2014", tableLocation + "/year=2014");
List<Partition> partitions = Lists.newArrayList(partition1, partition2);
String rootPath = tableLocation + "/addpartspectest/";
PartitionSpecProxy partitionSpec = buildPartitionSpec(DB_NAME, tableName, rootPath, partitions);
client.add_partitions_pspec(partitionSpec);
Partition part = client.getPartition(DB_NAME, tableName, "year=2013");
Assert.assertNotNull(part);
Assert.assertEquals(tableName, part.getTableName());
Assert.assertEquals(DB_NAME, part.getDbName());
Assert.assertEquals(tableLocation + "/year=2013", part.getSd().getLocation());
part = client.getPartition(DB_NAME, tableName, "year=2014");
Assert.assertNotNull(part);
Assert.assertEquals(tableName, part.getTableName());
Assert.assertEquals(DB_NAME, part.getDbName());
Assert.assertEquals(tableLocation + "/year=2014", part.getSd().getLocation());
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecEmptyDB.
@Test(expected = InvalidObjectException.class)
public void testAddPartitionSpecEmptyDB() throws Exception {
createTable();
Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec("", 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 testAddPartitionSpecWithSharedSDEmptyValue.
@Test
public void testAddPartitionSpecWithSharedSDEmptyValue() throws Exception {
Table table = createTable();
PartitionWithoutSD partition = new PartitionWithoutSD();
partition.setRelativePath("addpartspectest");
partition.setValues(Lists.newArrayList(""));
String location = table.getSd().getLocation() + "/nullValueTest/";
PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(Lists.newArrayList(partition), buildSD(location));
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=__HIVE_DEFAULT_PARTITION__", partitionNames.get(0));
}
Aggregations