use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecNoDBAndTableInPartition.
@Test(expected = MetaException.class)
public void testAddPartitionSpecNoDBAndTableInPartition() throws Exception {
createTable();
Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
partition.setDbName(null);
partition.setTableName(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 testAddPartitionSpecWithSharedSDNoValue.
@Test(expected = MetaException.class)
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));
client.add_partitions_pspec(partitionSpecProxy);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy in project hive by apache.
the class TestAddPartitionsFromPartSpec method testAddPartitionSpecForView.
@Test(expected = MetaException.class)
@ConditionalIgnoreOnSessionHiveMetastoreClient
public void testAddPartitionSpecForView() throws Exception {
String tableName = "test_add_partition_view";
createView(tableName);
Partition partition = buildPartition(DB_NAME, tableName, DEFAULT_YEAR_VALUE);
PartitionSpecProxy partitionSpecProxy = buildPartitionSpec(DB_NAME, tableName, 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 testAddPartitionSpecUpperCaseDBAndTableName.
@Test
public void testAddPartitionSpecUpperCaseDBAndTableName() throws Exception {
// Create table 'test_partition_db.test_add_part_table'
String tableName = "test_add_part_table";
String tableLocation = metaStore.getWarehouseRoot() + "/" + tableName.toUpperCase();
createTable(DB_NAME, tableName, getYearPartCol(), tableLocation);
// Create partitions with table name 'TEST_ADD_PART_TABLE' and db name 'TEST_PARTITION_DB'
Partition partition1 = buildPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "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.toUpperCase(), tableName.toUpperCase(), rootPath, partitions);
client.add_partitions_pspec(partitionSpec);
// Validate the partition attributes
// The db and table name should be all lower case: 'test_partition_db' and
// 'test_add_part_table'
// The location should be saved case-sensitive, it should be
// warehouse dir + "TEST_ADD_PART_TABLE/year=2017"
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());
Partition part1 = client.getPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "year=2013");
Assert.assertEquals(part, part1);
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());
part1 = client.getPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "year=2014");
Assert.assertEquals(part, part1);
}
use of org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy 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);
}
Aggregations