Search in sources :

Example 31 with PartitionBuilder

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

the class TestListPartitions method addPartition.

private static void addPartition(IMetaStoreClient client, Table table, List<String> values) throws TException {
    PartitionBuilder partitionBuilder = new PartitionBuilder().fromTable(table);
    values.forEach(val -> partitionBuilder.addValue(val));
    client.add_partition(partitionBuilder.build());
}
Also used : PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)

Example 32 with PartitionBuilder

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

the class TestDropPartitions method createPartition.

private Partition createPartition(String tableName, String location, List<String> values, List<FieldSchema> partCols, Map<String, String> partParams) throws Exception {
    Partition partition = new PartitionBuilder().setDbName(DB_NAME).setTableName(tableName).setValues(values).setCols(partCols).setLocation(location).setPartParams(partParams).build();
    client.add_partition(partition);
    partition = client.getPartition(DB_NAME, tableName, values);
    return partition;
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)

Aggregations

PartitionBuilder (org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)32 Partition (org.apache.hadoop.hive.metastore.api.Partition)28 Test (org.junit.Test)22 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)20 Table (org.apache.hadoop.hive.metastore.api.Table)19 EnvironmentContext (org.apache.hadoop.hive.metastore.api.EnvironmentContext)7 TableBuilder (org.apache.hadoop.hive.metastore.client.builder.TableBuilder)7 DatabaseBuilder (org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder)6 Database (org.apache.hadoop.hive.metastore.api.Database)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)3 Path (org.apache.hadoop.fs.Path)2 MetastoreUnitTest (org.apache.hadoop.hive.metastore.annotation.MetastoreUnitTest)2 ListenerEvent (org.apache.hadoop.hive.metastore.events.ListenerEvent)2 Before (org.junit.Before)2 File (java.io.File)1 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)1 InvalidPartitionException (org.apache.hadoop.hive.metastore.api.InvalidPartitionException)1 UnknownTableException (org.apache.hadoop.hive.metastore.api.UnknownTableException)1