Search in sources :

Example 66 with PartitionBuilder

use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.

the class TestAlterPartitions method testAlterPartitionsWithEnvironmentCtxMissingPartitionVals.

@Test(expected = MetaException.class)
public void testAlterPartitionsWithEnvironmentCtxMissingPartitionVals() throws Exception {
    createTable4PartColsParts(client);
    Table t = client.getTable(DB_NAME, TABLE_NAME);
    PartitionBuilder builder = new PartitionBuilder();
    Partition part = builder.inTable(t).build(metaStore.getConf());
    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());
}
Also used : EnvironmentContext(org.apache.hadoop.hive.metastore.api.EnvironmentContext) Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 67 with PartitionBuilder

use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.

the class TestAlterPartitions method testAlterPartitionMissingPartitionVals.

@Test(expected = MetaException.class)
public void testAlterPartitionMissingPartitionVals() throws Exception {
    createTable4PartColsParts(client);
    Table t = client.getTable(DB_NAME, TABLE_NAME);
    PartitionBuilder builder = new PartitionBuilder();
    Partition part = builder.inTable(t).build(metaStore.getConf());
    client.alter_partition(DB_NAME, TABLE_NAME, part);
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 68 with PartitionBuilder

use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.

the class TestAlterPartitions method testAlterPartitionsMissingPartitionVals.

@Test(expected = MetaException.class)
public void testAlterPartitionsMissingPartitionVals() throws Exception {
    createTable4PartColsParts(client);
    Table t = client.getTable(DB_NAME, TABLE_NAME);
    PartitionBuilder builder = new PartitionBuilder();
    Partition part = builder.inTable(t).build(metaStore.getConf());
    Partition part1 = client.listPartitions(DB_NAME, TABLE_NAME, (short) -1).get(0);
    client.alter_partitions(DB_NAME, TABLE_NAME, Lists.newArrayList(part, part1));
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 69 with PartitionBuilder

use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.

the class TestAlterPartitions method testAlterPartitionUnknownPartition.

@Test(expected = InvalidOperationException.class)
public void testAlterPartitionUnknownPartition() throws Exception {
    createTable4PartColsParts(client);
    Table t = client.getTable(DB_NAME, TABLE_NAME);
    PartitionBuilder builder = new PartitionBuilder();
    Partition part = builder.inTable(t).addValue("1111").addValue("11").addValue("11").build(metaStore.getConf());
    client.alter_partition(DB_NAME, TABLE_NAME, part);
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 70 with PartitionBuilder

use of org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder in project hive by apache.

the class TestAlterPartitions method testAlterPartitionWithEnvironmentCtxUnknownPartition.

@Test(expected = InvalidOperationException.class)
public void testAlterPartitionWithEnvironmentCtxUnknownPartition() throws Exception {
    createTable4PartColsParts(client);
    Table t = client.getTable(DB_NAME, TABLE_NAME);
    PartitionBuilder builder = new PartitionBuilder();
    Partition part = builder.inTable(t).addValue("1111").addValue("11").addValue("11").build(metaStore.getConf());
    client.alter_partition(DB_NAME, TABLE_NAME, part, new EnvironmentContext());
}
Also used : EnvironmentContext(org.apache.hadoop.hive.metastore.api.EnvironmentContext) Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

PartitionBuilder (org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)75 Partition (org.apache.hadoop.hive.metastore.api.Partition)63 Test (org.junit.Test)47 Table (org.apache.hadoop.hive.metastore.api.Table)44 TableBuilder (org.apache.hadoop.hive.metastore.client.builder.TableBuilder)33 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)28 DatabaseBuilder (org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder)27 Database (org.apache.hadoop.hive.metastore.api.Database)22 ArrayList (java.util.ArrayList)14 MetastoreUnitTest (org.apache.hadoop.hive.metastore.annotation.MetastoreUnitTest)10 CatalogBuilder (org.apache.hadoop.hive.metastore.client.builder.CatalogBuilder)10 EnvironmentContext (org.apache.hadoop.hive.metastore.api.EnvironmentContext)9 SQLCheckConstraint (org.apache.hadoop.hive.metastore.api.SQLCheckConstraint)7 SQLDefaultConstraint (org.apache.hadoop.hive.metastore.api.SQLDefaultConstraint)7 SQLNotNullConstraint (org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint)7 SQLUniqueConstraint (org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint)7 Catalog (org.apache.hadoop.hive.metastore.api.Catalog)6 HashMap (java.util.HashMap)5 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)5 HashSet (java.util.HashSet)4