use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.
the class TestAlterPartitions method testAlterPartitionWithEnvironmentCtxIncompletePartitionVals.
@Test(expected = MetaException.class)
public void testAlterPartitionWithEnvironmentCtxIncompletePartitionVals() throws Exception {
createTable4PartColsParts(client);
Table t = client.getTable(DB_NAME, TABLE_NAME);
PartitionBuilder builder = new PartitionBuilder();
Partition part = builder.fromTable(t).addValue("2017").build();
client.alter_partition(DB_NAME, TABLE_NAME, part, new EnvironmentContext());
}
use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.
the class TestAlterPartitions method testAlterPartitionsUnknownPartition.
@Test
public void testAlterPartitionsUnknownPartition() throws Exception {
Partition part1 = null;
try {
createTable4PartColsParts(client);
Table t = client.getTable(DB_NAME, TABLE_NAME);
PartitionBuilder builder = new PartitionBuilder();
Partition part = builder.fromTable(t).addValue("1111").addValue("11").addValue("11").build();
part1 = client.listPartitions(DB_NAME, TABLE_NAME, (short) -1).get(0);
makeTestChangesOnPartition(part1);
client.alter_partitions(DB_NAME, TABLE_NAME, Lists.newArrayList(part, part1));
fail("Should have thrown InvalidOperationException");
} catch (InvalidOperationException e) {
part1 = client.listPartitions(DB_NAME, TABLE_NAME, (short) -1).get(0);
assertPartitionUnchanged(part1, part1.getValues(), PARTCOL_SCHEMA);
}
}
use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.
the class TestAlterPartitions method testAlterPartitionWithEnvironmentCtxMissingPartitionVals.
@Test(expected = MetaException.class)
public void testAlterPartitionWithEnvironmentCtxMissingPartitionVals() throws Exception {
createTable4PartColsParts(client);
Table t = client.getTable(DB_NAME, TABLE_NAME);
PartitionBuilder builder = new PartitionBuilder();
Partition part = builder.fromTable(t).build();
client.alter_partition(DB_NAME, TABLE_NAME, part, new EnvironmentContext());
}
use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.
the class TestAlterPartitions method testAlterPartitionsWithEnvironmentCtxUnknownPartition.
@Test(expected = InvalidOperationException.class)
public void testAlterPartitionsWithEnvironmentCtxUnknownPartition() throws Exception {
createTable4PartColsParts(client);
Table t = client.getTable(DB_NAME, TABLE_NAME);
PartitionBuilder builder = new PartitionBuilder();
Partition part = builder.fromTable(t).addValue("1111").addValue("11").addValue("11").build();
Partition part1 = client.listPartitions(DB_NAME, TABLE_NAME, (short) -1).get(0);
client.alter_partitions(DB_NAME, TABLE_NAME, Lists.newArrayList(part, part1), new EnvironmentContext());
}
use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.
the class TestAppendPartitions method createPartition.
private void createPartition(Table table, List<String> values) throws Exception {
Partition partition = new PartitionBuilder().fromTable(table).setValues(values).build();
client.add_partition(partition);
}
Aggregations