Search in sources :

Example 61 with Partition

use of org.apache.hadoop.hive.metastore.api.Partition 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);
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) PartitionBuilder(org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)

Example 62 with Partition

use of org.apache.hadoop.hive.metastore.api.Partition in project hive by apache.

the class TestGetPartitions method testGetPartitionByValues.

/**
 * Testing getPartition(String,String,List(String)) ->
 *         get_partition(String,String,List(String)).
 * @throws Exception
 */
@Test
public void testGetPartitionByValues() throws Exception {
    createTable3PartCols1Part(client);
    List<String> parts = Lists.newArrayList("1997", "05", "16");
    Partition partition = client.getPartition(DB_NAME, TABLE_NAME, parts);
    assertNotNull(partition);
    assertEquals(parts, partition.getValues());
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 63 with Partition

use of org.apache.hadoop.hive.metastore.api.Partition in project hive by apache.

the class TestGetPartitions method testGetPartitionWithAuthInfo.

@Test
public void testGetPartitionWithAuthInfo() throws Exception {
    createTable3PartCols1PartAuthOn(client);
    Partition partition = client.getPartitionWithAuthInfo(DB_NAME, TABLE_NAME, Lists.newArrayList("1997", "05", "16"), "user0", Lists.newArrayList("group0"));
    assertNotNull(partition);
    assertAuthInfoReturned("user0", "group0", partition);
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 64 with Partition

use of org.apache.hadoop.hive.metastore.api.Partition in project hive by apache.

the class TestGetPartitions method testGetPartitionWithAuthInfoEmptyUserGroup.

@Test
public void testGetPartitionWithAuthInfoEmptyUserGroup() throws Exception {
    createTable3PartCols1PartAuthOn(client);
    Partition partition = client.getPartitionWithAuthInfo(DB_NAME, TABLE_NAME, Lists.newArrayList("1997", "05", "16"), "", Lists.newArrayList(""));
    assertNotNull(partition);
    assertAuthInfoReturned("", "", partition);
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 65 with Partition

use of org.apache.hadoop.hive.metastore.api.Partition in project hive by apache.

the class TestGetPartitions method testGetPartitionWithAuthInfoNoPrivilagesSet.

/**
 * Testing getPartitionWithAuthInfo(String,String,List(String),String,List(String)) ->
 *         get_partition_with_auth(String,String,List(String),String,List(String)).
 * @throws Exception
 */
@Test
public void testGetPartitionWithAuthInfoNoPrivilagesSet() throws Exception {
    createTable3PartCols1Part(client);
    Partition partition = client.getPartitionWithAuthInfo(DB_NAME, TABLE_NAME, Lists.newArrayList("1997", "05", "16"), "", Lists.newArrayList());
    assertNotNull(partition);
    assertNull(partition.getPrivileges());
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

Partition (org.apache.hadoop.hive.metastore.api.Partition)730 Test (org.junit.Test)430 Table (org.apache.hadoop.hive.metastore.api.Table)312 ArrayList (java.util.ArrayList)303 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)254 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)131 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)115 List (java.util.List)109 Path (org.apache.hadoop.fs.Path)109 StorageDescriptor (org.apache.hadoop.hive.metastore.api.StorageDescriptor)107 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)87 SerDeInfo (org.apache.hadoop.hive.metastore.api.SerDeInfo)71 HashMap (java.util.HashMap)64 PartitionBuilder (org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder)63 TException (org.apache.thrift.TException)62 IOException (java.io.IOException)61 Database (org.apache.hadoop.hive.metastore.api.Database)55 PartitionSpecProxy (org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy)52 FileSystem (org.apache.hadoop.fs.FileSystem)40 ColumnStatisticsObj (org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj)40